3rd Party APIs Example

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)
home_team Chelsea
away_team Milan
id 218522
market classic
competition_name grp. E
prediction X2
competition_cluster Champions League
status lost
federation UEFA
is_expired True
season 2022 - 2023
result 3 - 0
start_date 2022-10-05T20:00:00
last_update_at 2022-10-05T17:09:19.757643
odds {'1': 1.711, 'X': 3.904, '2': 4.95, '1X': 1.177, 'X2': 2.134, '12': 1.254}

Hacks: