mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-11-20 13:29:03 +00:00
Allow use of orjson instead of json
The difference in speed seems negligible at start up, which is when most time is taken for actually parsing JSON. I could potentially be missing something but profiling didn't point to any discernable difference.
This commit is contained in:
1 parent
e0a9365d61
commit
88d825a803
4 files changed
+27
-6
No files matched your search
+1
-1
@@ -99,7 +99,7 @@ async def json_or_text(response: aiohttp.ClientResponse) -> Union[Dict[str, Any]
|
||||
text = await response.text(encoding='utf-8')
|
||||
try:
|
||||
if response.headers['content-type'] == 'application/json':
|
||||
return json.loads(text)
|
||||
return utils.from_json(text)
|
||||
except KeyError:
|
||||
# Thanks Cloudflare
|
||||
pass
|
||||
|
||||
Reference in new issue
Block a user