Python package that wraps Ergast F1 API
Project description
Formula1Py
Ergast API Python Wrapper
Install
pip install formula1py
Usage
import json
from formula1py import F1
# no args
f1 = F1()
# http[s]
f1 = F1(secure=True)
# the api supports an offset and a limit
f1 = F1(secure=False, offset=20, limit=20)
# defaults to text/xml
f1.current_schedule().json
f1.all_drivers().json
f1.all_circuits().xml
# adding season to some endpoints
f1.season_schedule(season=2004).json
f1.race_standings(season=2020).json
f1.constructor_standings(season=2013).xml
# just the url
f1.driver_season(season=2020).url
# also supports random
print(json.dumps(f1.random(season=2020).json, indent=2)
>> > from formula1py import F1
>> > f1 = F1(secure=True)
>> > f1_season = f1.driver_season(season=2002)
>> > print(f1_season.url)
>> > print(f1_season.json)
Example Response
{
"season": "2021",
"round": "1",
"url": "https://en.wikipedia.org/wiki/2021_Bahrain_Grand_Prix",
"raceName": "Bahrain Grand Prix",
"Circuit": {
"circuitId": "bahrain",
"url": "http://en.wikipedia.org/wiki/Bahrain_International_Circuit",
"circuitName": "Bahrain International Circuit",
"Location": {
"lat": "26.0325",
"long": "50.5106",
"locality": "Sakhir",
"country": "Bahrain"
}
},
"date": "2021-03-28",
"time": "15:00:00Z"
}
Dev
make deps
make test
ToDo
- More Tests
- More Endpoints
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
formula1py-0.9.0.tar.gz
(14.6 kB
view hashes)
Built Distribution
Close
Hashes for formula1py-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7468256277f1f5021f9d075ba8d0e0f5663e5d236577de6d9d505d27c14f20f9 |
|
MD5 | ae3c4942949fe8177e5745192d09de70 |
|
BLAKE2b-256 | adaf30f8388f57642496f6742e6729585b9b82544947d4fedbbcffb7fad74898 |