diff --git a/fastf1/_api.py b/fastf1/_api.py index e5e3aa5ba..4880750b6 100644 --- a/fastf1/_api.py +++ b/fastf1/_api.py @@ -28,9 +28,9 @@ _logger = get_logger('api') base_url = 'https://livetiming.formula1.com' +base_url_mirror = 'https://livetiming-mirror.fastf1.dev' headers: Dict[str, str] = { - 'Host': 'livetiming.formula1.com', 'Connection': 'close', 'TE': 'identity', 'User-Agent': 'BestHTTP', @@ -1699,7 +1699,14 @@ def fetch_page(path, name): page = pages[name] is_stream = 'jsonStream' in page is_z = '.z.' in page + r = Cache.requests_get(base_url + path + pages[name], headers=headers) + + if r.status_code >= 400: + _logger.debug(f"Falling back to livetiming mirror ({base_url_mirror})") + r = Cache.requests_get(base_url_mirror + path + pages[name], + headers=headers) + if r.status_code == 200: raw = r.content.decode('utf-8-sig') if is_stream: