MCPcopy
hub / github.com/encode/httpx / render_data

Method render_data

httpx/_multipart.py:203–217  ·  httpx/_multipart.py::FileField.render_data
(self)

Source from the content-addressed store, hash-verified

201 return self._headers
202
203 def render_data(self) -> typing.Iterator[bytes]:
204 if isinstance(self.file, (str, bytes)):
205 yield to_bytes(self.file)
206 return
207
208 if hasattr(self.file, class="st">"seek"):
209 try:
210 self.file.seek(0)
211 except io.UnsupportedOperation:
212 pass
213
214 chunk = self.file.read(self.CHUNK_SIZE)
215 while chunk:
216 yield to_bytes(chunk)
217 chunk = self.file.read(self.CHUNK_SIZE)
218
219 def render(self) -> typing.Iterator[bytes]:
220 yield self.render_headers()

Callers 1

renderMethod · 0.95

Calls 2

to_bytesFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected