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

Method text

aiohttp/multipart.py:388–398  ·  view source on GitHub ↗

Lke :meth:`read`, but assumes that body part contains text data. :param str encoding: Custom text encoding. Overrides specified in charset param of `Content-Type` header :rtype: str

(self, *, encoding=None)

Source from the content-addressed store, hash-verified

386
387 @asyncio.coroutine
388 def text(self, *, encoding=None):
389 """Lke :meth:`read`, but assumes that body part contains text data.
390
391 :param str encoding: Custom text encoding. Overrides specified
392 in charset param of `Content-Type` header
393
394 :rtype: str
395 """
396 data = yield from self.read(decode=True)
397 encoding = encoding or self.get_charset(default='latin1')
398 return data.decode(encoding)
399
400 @asyncio.coroutine
401 def json(self, *, encoding=None):

Callers 5

test_read_textMethod · 0.95

Calls 3

readMethod · 0.95
get_charsetMethod · 0.95
decodeMethod · 0.80

Tested by 5

test_read_textMethod · 0.76