mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-21 18:41:28 +00:00
Set some timeouts for initial connection to instance
This commit is contained in:
parent
50e8a30852
commit
da86e366a9
|
@ -48,7 +48,7 @@ class current_instance:
|
||||||
current_instance.token = new_token
|
current_instance.token = new_token
|
||||||
current_instance.listen_token = None
|
current_instance.listen_token = None
|
||||||
if new_token:
|
if new_token:
|
||||||
current_instance.s.get(f'https://{current_instance.instance}')
|
current_instance.s.get(f'https://{current_instance.instance}', timeout=30)
|
||||||
current_instance.s.headers.update({"Authorization": "Bearer " + new_token})
|
current_instance.s.headers.update({"Authorization": "Bearer " + new_token})
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ if current_instance.token:
|
||||||
current_instance.s.headers.update({"Authorization": "Bearer " + current_instance.token})
|
current_instance.s.headers.update({"Authorization": "Bearer " + current_instance.token})
|
||||||
else:
|
else:
|
||||||
# Get cookies from unauthorized instance for working some functionality (radios)
|
# Get cookies from unauthorized instance for working some functionality (radios)
|
||||||
current_instance.s.get(f'https://{current_instance.instance}/')
|
current_instance.s.get(f'https://{current_instance.instance}/', timeout=30)
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
|
@ -79,7 +79,8 @@ def get_instance_settings():
|
||||||
|
|
||||||
def get_node_info():
|
def get_node_info():
|
||||||
r = current_instance.s.get(
|
r = current_instance.s.get(
|
||||||
f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/')
|
f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/',
|
||||||
|
timeout=30)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue