Unit 1.5
Developing Backend 3rd Party APIs with analysis and cleaning Python, Flask, Pandas
import requests
url = "https://football-prediction-api.p.rapidapi.com/api/v2/predictions"
querystring = {"market":"classic","iso_date":"2022-10-05","federation":"UEFA"}
headers = {
"X-RapidAPI-Key": "686830ba27msh513db9752c312c4p1115d7jsn310f307263ee",
"X-RapidAPI-Host": "football-prediction-api.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers, params=querystring)
# print(response.text)
teams = response.json().get('data')
for team in teams: # the specific team in the list of teams/games on the day
if team["home_team"] == "Chelsea": # this filters for the team Chelsea
for key, value in team.items(): # this finds the Chelsea game and the statistics of the game
print(key, value)
Hacks: