diff --git a/fastf1/ergast/interface.py b/fastf1/ergast/interface.py index a157a8f43..301c58933 100644 --- a/fastf1/ergast/interface.py +++ b/fastf1/ergast/interface.py @@ -16,6 +16,7 @@ BASE_URL = 'https://ergast.com/api/f1' +TIMEOUT = 5.0 HEADERS = {'User-Agent': f'FastF1/{__version_short__}'} @@ -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'))