mirror of
https://github.com/glomatico/gamdl.git
synced 2026-06-13 04:05:14 +03:00
Make safe_json return None on parse error
This commit is contained in:
+2
-2
@@ -14,11 +14,11 @@ def raise_for_status(httpx_response: httpx.Response, valid_responses: set[int] =
|
||||
)
|
||||
|
||||
|
||||
def safe_json(httpx_response: httpx.Response) -> dict:
|
||||
def safe_json(httpx_response: httpx.Response) -> dict | None:
|
||||
try:
|
||||
return httpx_response.json()
|
||||
except (json.JSONDecodeError, UnicodeDecodeError):
|
||||
return {}
|
||||
return None
|
||||
|
||||
|
||||
async def get_response(
|
||||
|
||||
Reference in New Issue
Block a user