🛠️ Implemented timeout for `requests calls.

This commit is contained in:
Robert Honz
2024-01-12 08:38:41 +01:00
parent 1494490476
commit 69cf0b4707
4 changed files with 9 additions and 4 deletions
+4 -1
View File
@@ -61,6 +61,8 @@ __ERROR_KEY__ = (
},
)
from constants import REQUESTS_TIMEOUT_SEC
def getNum():
return len(__API_KEYS__["keys"])
@@ -94,7 +96,8 @@ def getVersion():
# Load from gist
try:
respond = requests.get("https://api.github.com/gists/48d01f5a24b4b7b37f19443977c22cd6")
respond = requests.get("https://api.github.com/gists/48d01f5a24b4b7b37f19443977c22cd6",
timeout=REQUESTS_TIMEOUT_SEC)
if respond.status_code == 200:
content = respond.json()["files"]["tidal-api-key.json"]["content"]
__API_KEYS__ = json.loads(content)