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

Method json

aiohttp/multipart.py:401–411  ·  view source on GitHub ↗

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

(self, *, encoding=None)

Source from the content-addressed store, hash-verified

399
400 @asyncio.coroutine
401 def json(self, *, encoding=None):
402 """Lke :meth:`read`, but assumes that body parts contains JSON data.
403
404 :param str encoding: Custom JSON encoding. Overrides specified
405 in charset param of `Content-Type` header
406 """
407 data = yield from self.read(decode=True)
408 if not data:
409 return None
410 encoding = encoding or self.get_charset(default='utf-8')
411 return json.loads(data.decode(encoding))
412
413 @asyncio.coroutine
414 def form(self, *, encoding=None):

Callers 5

test_read_jsonMethod · 0.95

Calls 3

readMethod · 0.95
get_charsetMethod · 0.95
decodeMethod · 0.80

Tested by 5

test_read_jsonMethod · 0.76