mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-16 22:15:09 +00:00
Make HTTPClient.request use orjson if it exists
This commit is contained in:
parent
0a2efb58cd
commit
5d1ce5b572
2 changed files with 2 additions and 3 deletions
|
@ -18,6 +18,7 @@ try:
|
|||
import orjson
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
json_loads = json.loads
|
||||
else:
|
||||
json_loads = orjson.loads
|
||||
|
@ -188,7 +189,6 @@ class HTTPClient:
|
|||
async with self.__session.request(
|
||||
method, f"https://api.github.com{path}", **kwargs
|
||||
) as response:
|
||||
|
||||
headers = response.headers
|
||||
|
||||
self._rates = RateLimits(
|
||||
|
@ -202,7 +202,7 @@ class HTTPClient:
|
|||
)
|
||||
|
||||
if 200 <= response.status <= 299:
|
||||
data = await response.text(encoding='utf-8')
|
||||
data = await response.text(encoding="utf-8")
|
||||
|
||||
if response.headers["Content-Type"] == "application/json":
|
||||
return json_loads(data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue