Skip to content

Commit

Permalink
Fix issue regarding json conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
WitherredAway committed May 20, 2022
1 parent fc33ff2 commit 5f1a6ed
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gists/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import typing
import yarl
import asyncio
import aiohttp
import sys

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 5f1a6ed

Please sign in to comment.