From 0eff7449a828176b905947b3764e7136864ce242 Mon Sep 17 00:00:00 2001 From: theOehrly <23384863+theOehrly@users.noreply.github.com> Date: Sun, 17 Nov 2024 22:06:20 +0100 Subject: [PATCH] FIX: use custom user agent when requesting event schedule data from GH (#656) --- fastf1/events.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fastf1/events.py b/fastf1/events.py index 80863b886..977ce6204 100644 --- a/fastf1/events.py +++ b/fastf1/events.py @@ -202,6 +202,7 @@ import fastf1._api import fastf1.ergast +from fastf1 import __version_short__ from fastf1.core import Session from fastf1.internals.fuzzy import fuzzy_matcher from fastf1.internals.pandas_base import ( @@ -235,6 +236,7 @@ _SCHEDULE_BASE_URL = "https://raw.githubusercontent.com/" \ "theOehrly/f1schedule/master/" +_HEADERS = {'User-Agent': f'FastF1/{__version_short__}'} def get_session( @@ -580,7 +582,8 @@ def get_events_remaining( _logger) def _get_schedule_ff1(year): response = Cache.requests_get( - _SCHEDULE_BASE_URL + f"schedule_{year}.json" + _SCHEDULE_BASE_URL + f"schedule_{year}.json", + headers=_HEADERS ) data = dict()