diff options
| author | Robert Honz <exislow+github@gmail.com> | 2024-01-12 08:38:41 +0100 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2024-01-12 08:38:41 +0100 |
| commit | 69cf0b4707ea95789616309847698fb78a6a633d (patch) | |
| tree | ae051f1bdadcc14dff4346037493139499a2766f /tidal_dl_ng/api.py | |
| parent | 1494490476d57a49ff8a69ed4baecf5eea4a0d97 (diff) | |
| download | tidal-dl-ng-69cf0b4707ea95789616309847698fb78a6a633d.tar.gz | |
🛠️ Implemented timeout for `requests calls.
Diffstat (limited to 'tidal_dl_ng/api.py')
| -rw-r--r-- | tidal_dl_ng/api.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tidal_dl_ng/api.py b/tidal_dl_ng/api.py index c68665e..20a2ace 100644 --- a/tidal_dl_ng/api.py +++ b/tidal_dl_ng/api.py @@ -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) |
