MCPcopy
hub / github.com/aio-libs/aiohttp / read

Method read

aiohttp/multipart.py:239–259  ·  view source on GitHub ↗

Reads body part data. :param bool decode: Decodes data following by encoding method from `Content-Encoding` header. If it missed data remains untouched :rtype: bytearray

(self, *, decode=False)

Source from the content-addressed store, hash-verified

237
238 @asyncio.coroutine
239 def read(self, *, decode=False):
240 """Reads body part data.
241
242 :param bool decode: Decodes data following by encoding
243 method from `Content-Encoding` header. If it missed
244 data remains untouched
245
246 :rtype: bytearray
247 """
248 if self._at_eof:
249 return b''
250 data = bytearray()
251 if self._length is None:
252 while not self._at_eof:
253 data.extend((yield from self.readline()))
254 else:
255 while not self._at_eof:
256 data.extend((yield from self.read_chunk(self.chunk_size)))
257 if decode:
258 return self.decode(data)
259 return data
260
261 @asyncio.coroutine
262 def read_chunk(self, size=chunk_size):

Callers 15

nextMethod · 0.95
textMethod · 0.95
jsonMethod · 0.95
formMethod · 0.95
test_readMethod · 0.95
test_multireadMethod · 0.95
test_read_multilineMethod · 0.95

Calls 4

readlineMethod · 0.95
read_chunkMethod · 0.95
decodeMethod · 0.95
extendMethod · 0.80