Skip to content

Commit

Permalink
ENH: reduce Ergast connection timeout to prevent extremley long waiti…
Browse files Browse the repository at this point in the history
…ng times
  • Loading branch information
theOehrly committed Jul 25, 2024
1 parent 01b6890 commit 193afd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fastf1/ergast/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


BASE_URL = 'https://ergast.com/api/f1'
TIMEOUT = 5.0
HEADERS = {'User-Agent': f'FastF1/{__version_short__}'}


Expand Down Expand Up @@ -487,7 +488,8 @@ def _build_url(
@classmethod
def _get(cls, url: str, params: dict) -> Union[dict, list]:
# request data from ergast and load the returned json data.
r = Cache.requests_get(url, headers=HEADERS, params=params)
r = Cache.requests_get(url, headers=HEADERS, params=params,
timeout=TIMEOUT)
if r.status_code == 200:
try:
return json.loads(r.content.decode('utf-8'))
Expand Down

0 comments on commit 193afd1

Please sign in to comment.