Add timeout to requests

This commit is contained in:
Robert Chacón 2023-03-22 15:44:03 -06:00 committed by GitHub
parent 822f83407a
commit 1837ee6e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ def spylnxRequest(target, headers):
# Sends a REST GET request to Spylnx and returns the
# result in JSON
url = splynx_api_url + "/api/2.0/" + target
r = requests.get(url, headers=headers)
r = requests.get(url, headers=headers, timeout=10)
return r.json()
def getTariffs(headers):