f1verse
f1verse · Python

How do I get an entire F1 race as JSON in one call?

Call race.story(). One request returns results, lead changes, laps led, the event timeline, tyre stints, race pace and safety-car interruptions as a single JSON-safe dictionary.

>>> race = f1verse.load(2026, 12)
>>> story = race.story()
>>> sorted(story)
['event', 'interruptions', 'laps_led', 'leader_runs', 'race_pace',
 'results', 'schema_version', 'sources', 'state', 'stints', 'timeline']
>>> json.dumps(story)          # never raises

Every public return value in f1verse is JSON-safe by construction, so nothing has to be coaxed out of a dataframe or a custom class before it reaches a template, a queue or a language model.

race_pace() inside the story is a median with pit, safety-car and virtual-safety-car laps already excluded. Pace that includes a pit lap is not pace.

Related