mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2026-02-04 10:14:15 +02:00
Still do handle for JSONDecodeError
This commit is contained in:
@@ -2,6 +2,7 @@ import cachetools
|
|||||||
import requests
|
import requests
|
||||||
import typing
|
import typing
|
||||||
import abc
|
import abc
|
||||||
|
import json
|
||||||
|
|
||||||
from . import configs
|
from . import configs
|
||||||
from . import exceptions
|
from . import exceptions
|
||||||
@@ -191,7 +192,10 @@ class DiscordOAuth2HttpClient(abc.ABC):
|
|||||||
except requests.HTTPError:
|
except requests.HTTPError:
|
||||||
return response.text
|
return response.text
|
||||||
|
|
||||||
return response.json()
|
try:
|
||||||
|
return response.json()
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
return response.text
|
||||||
|
|
||||||
def bot_request(self, route: str, method="GET", **kwargs) -> typing.Union[dict, str]:
|
def bot_request(self, route: str, method="GET", **kwargs) -> typing.Union[dict, str]:
|
||||||
"""Make HTTP request to specified endpoint with bot token as authorization headers.
|
"""Make HTTP request to specified endpoint with bot token as authorization headers.
|
||||||
|
|||||||
Reference in New Issue
Block a user