Skip to content

Instantly share code, notes, and snippets.

@se7enack
Created January 19, 2026 23:28
Show Gist options
  • Select an option

  • Save se7enack/223372efd0a70cfd65083e4468893720 to your computer and use it in GitHub Desktop.

Select an option

Save se7enack/223372efd0a70cfd65083e4468893720 to your computer and use it in GitHub Desktop.
import requests
import json
def get_f1_schedule(year=2026):
url = f"https://api.openf1.org/v1/meetings?year={year}"
resp = requests.get(url, timeout=15)
resp.raise_for_status()
meetings = resp.json()
schedule = []
for i, m in enumerate(meetings, start=1):
schedule.append({
"round": i,
"name": m.get("meeting_name"),
"start": m.get("date_start")[:10],
"end": m.get("date_end")[:10],
"location": m.get("location"),
"country": m.get("country_name"),
"circuit": m.get("circuit_short_name")
})
return schedule
# call 'schedule' from whereever you need it
schedule = get_f1_schedule(2026)
# you can comment this bit out
print(json.dumps(schedule, indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment