diff --git a/gists/client.py b/gists/client.py index 6a848be..b23d960 100644 --- a/gists/client.py +++ b/gists/client.py @@ -1,6 +1,4 @@ import typing -import yarl -import asyncio import aiohttp import sys @@ -61,11 +59,12 @@ async def request( response = await session.request( method, request_url, params=params, json=data, headers=headers_final ) + try: data = await response.json() except aiohttp.client_exceptions.ContentTypeError: - raise DataFetchError("Invalid data fetched, failed to convert to json.") - + data = response.content + remaining = response.headers.get("X-Ratelimit-Remaining") if 300 > response.status >= 200: