Add timeouts to the calls to the GTFS-R API

This commit is contained in:
2023-11-11 15:46:51 +00:00
parent 3c3199e3eb
commit b5d9fa1dd8
+1 -1
View File
@@ -257,7 +257,7 @@ class GTFSClient():
# Poll GTFS-R API
if self.gtfs_r_api_key != "":
headers = {"x-api-key": self.gtfs_r_api_key}
response = requests.get(url = self.gtfs_r_url, headers = headers)
response = requests.get(url = self.gtfs_r_url, headers = headers, timeout=(2, 10))
if response.status_code != 200:
print("GTFS-R sent non-OK response: {}\n{}".format(response.status_code, response.text))
return ({}, [], [])