Ignore content type checking for aiohttp

Pass content_type=None as per the document suggests:

https://docs.aiohttp.org/en/stable/client_advanced.html#disabling-content-type-validation-for-json-responses
This commit is contained in:
Felix Yan 2018-11-29 06:37:47 +08:00
parent c966e6faf8
commit e3d62d4169
No known key found for this signature in database
GPG Key ID: 786C63F330D7CB92
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ def simple_json(urlpat, confkey, version_from_json):
kwargs["proxy"] = conf.get('proxy')
async with session.get(url, **kwargs) as res:
data = await res.json()
data = await res.json(content_type=None)
version = version_from_json(data)
return version

View File

@ -64,7 +64,7 @@ class ResponseManager:
async def __aexit__(self, exc_type, exc, tb):
pass
async def json_response(self):
async def json_response(self, **kwargs):
return json.loads(self.body.decode('utf-8'))
async def read(self):