feat: added timeout and make visible http error
This commit is contained in:
1 parent
82dbe7f887
commit
15158454f3
1 file changed
+4
-1
@@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user