mirror of
https://github.com/norohind/SquadsActivityMonitor.git
synced 2026-10-22 17:12:08 +03:00
Set timeout for http requests
This commit is contained in:
1 parent
62b1c0d24d
commit
2c6978dcdb
1 file changed
+4
-1
@@ -91,6 +91,7 @@ def proxied_request(url: str, method: str = 'get', **kwargs) -> requests.Respons
|
||||
url=url,
|
||||
proxies=proxies,
|
||||
headers={'Authorization': f'Bearer {_get_bearer()}'},
|
||||
timeout=30,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@@ -124,7 +125,8 @@ def _get_bearer() -> str:
|
||||
:return: bearer token as str
|
||||
"""
|
||||
bearer_request: requests.Response = requests.get(
|
||||
url='https://capi.demb.uk/random_token', headers={'auth': os.environ['DEMB_CAPI_AUTH']})
|
||||
url='https://capi.demb.uk/random_token', headers={'auth': os.environ['DEMB_CAPI_AUTH']}, timeout=30
|
||||
)
|
||||
|
||||
try:
|
||||
bearer: str = bearer_request.json()['access_token']
|
||||
@@ -159,3 +161,4 @@ def measure(function: callable, name_to_display: str):
|
||||
return result
|
||||
|
||||
return decorated
|
||||
|
||||
Reference in new issue
Block a user