Skip to content

Commit

Permalink
moved to ergast api
Browse files Browse the repository at this point in the history
  • Loading branch information
vantage-ola committed Jul 29, 2024
1 parent 4b8b3f7 commit 08504a5
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tracknow/backend/motorsport/formula_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
current_year = datetime.datetime.now().year


api_url = 'https://f1-live-motorsport-data.p.rapidapi.com'

team_standings = f"{api_url}/constructors/standings/{current_year}"
driver_standings = f"{api_url}/drivers/standings/{current_year}"

headers = {
#https://rapidapi.com/sportcontentapi/api/f1-live-motorsport-data
#api_url = 'https://f1-live-motorsport-data.p.rapidapi.com'
"""headers = {
"x-rapidapi-key": config('FORMULA_1_KEY'),
"x-rapidapi-host": "f1-live-motorsport-data.p.rapidapi.com"
}
}"""


api_url = 'https://ergast.com/api/f1/current'
team_standings = f"{api_url}/constructorStandings.json"
driver_standings = f"{api_url}/driverStandings.json"


def get_team_standings():
response = requests.get(team_standings, headers=headers)
response = requests.get(team_standings)
team = response.json()
return team

def get_driver_standings():
response = requests.get(driver_standings, headers=headers)
response = requests.get(driver_standings)
driver = response.json()
return driver

0 comments on commit 08504a5

Please sign in to comment.