Retrieves F1 GP results for any event
Usage:
$python retrieve_stats.py 2013 Spain qualifyingWill return JSON-encoded results for the 2013 Spain Quailfying session:
{"2013": {"Spain": {"qualifying": [{"Q1": "1:21.913", "Q3": " 1:20.718", "Q2": " 1:21.776", "No": "9", "Laps": "12", "Driver": "Nico Rosberg", "Pos" : "1", "Team": "Mercedes"}, {"Q1": "1:21.728", "Q3": " 1:20.972", "Q2": " 1:21.001", "No": "10", "Laps": "12", "Driver": "Lewis Hamilton", "Pos": "2 ", "Team": "Mercedes"}, {"Q1": "1:22.158", "Q3": " 1:21.054", "Q2": " 1:21.602", "No": "1", "Laps": "12", "Driver": "Sebastian Vettel", "Pos": "3", "Team": "Red Bull Racing-Renault"}, {"Q1": "1:22.210", "Q3": " 1:21.177", "Q2": " 1:21.676", "No": "7", "Laps": "17", "Driver": "Kimi R\u00e4ikk\u00 f6nen", "Pos": "4", "Team": "Lotus-Renault"}, ...$python retrieve_stats.py 2013 Monaco allwill return
{"2013": {"Monaco": {"practice 1": [{"No": "9", "Laps": "31", "Driver": "Nico Rosberg", "Pos": "1", "Gap": "[]", "Team": "Mercedes", "Time/Retired": "1:16.195"}, ...
"practice 2": [..],
"practice 3": [..],
"qualifying": [..],
"race": [..]Imports all practices sessions from a JSON, given through stdin:
$python retrieve_stats.py 2013 Spain all > 2013_Spain_all.json
$python import_practices.py < 2013_Spain_all.jsonor just using pipe without intermediate files:
$python retrieve_stats.py 2013 Spain all | python import_practices.py Will add all entries to the practices table.
If there are entries with unknown drivers, new entry will be added. Driver birthday and nationality would be fetched from wiki page, if found
Base tables and API for F1 results could be found here: http://ergast.com/mrd/