feat: added timeout and make visible http error
This commit is contained in:
parent
82dbe7f887
commit
15158454f3
@ -2,7 +2,10 @@ import requests
|
|||||||
|
|
||||||
|
|
||||||
def fetch_user(username: str) -> dict:
|
def fetch_user(username: str) -> dict:
|
||||||
response = requests.get(f"https://www.codewars.com/api/v1/users/{username}")
|
response = requests.get(
|
||||||
|
f"https://www.codewars.com/api/v1/users/{username}", timeout=5.0
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user