1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-17 14:35:09 +00:00

Make HTTPClient.request use orjson if it exists

This commit is contained in:
RGBCube 2022-06-28 15:41:07 +03:00 committed by Automated Linter
parent 0a2efb58cd
commit 5d1ce5b572
2 changed files with 2 additions and 3 deletions

View file

@ -23,7 +23,6 @@ def make_link_role(resource_links: Dict[str, str]) -> RoleFunction:
options: Dict = {},
content: List[str] = [],
) -> Tuple[List[Node], List[system_message]]:
text = utils.unescape(text)
has_explicit_title, title, key = split_explicit_title(text)
full_url = resource_links[key]

View file

@ -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)