Exemple #1
0
def get_h2h(team1Id=0, team2Id=0):
    url = "fixtures/h2h/{team1Id}/{team2Id}"
    url = URL(url.format(team1Id=team1Id, team2Id=team2Id))
    response = requests.get(url, headers=headers)
    response = response.json()
    api = response["api"]
    count = api["results"]
    items = api["fixtures"]
    return None if not (count > 0) or count != len(items) else items
Exemple #2
0
def get_stats(teamId=0, leagueId=0):
    url = "statistics/{leagueId}/{teamId}"
    url = URL(url.format(leagueId=leagueId, teamId=teamId))
    response = requests.get(url, headers=headers)
    response = response.json()
    api = response["api"]
    count = api["results"]
    items = api["statistics"]
    return None if not (count > 0) else items
Exemple #3
0
def get_teams(leagueId = 0):
	url = "teams/league/{leagueId}"
	url = URL(url.format(leagueId = leagueId))
	response = requests.get(url, headers=headers)
	response = response.json()
	api = response["api"]
	count = api["results"]
	items = api["teams"]
	return None if not(count > 0) or count != len(items) else items
Exemple #4
0
def get_team(teamId = 0):
	url = "teams/team/{teamId}"
	url = URL(url.format(teamId = teamId))
	response = requests.get(url, headers=headers)
	response = response.json()
	api = response["api"]
	count = api["results"]
	items = api["teams"]
	return None if not(count == 1) or count != len(items) else items[0]
Exemple #5
0
def get_leagues():
    url = "leagues"
    url = URL(url)
    response = requests.get(url, headers=headers)
    response = response.json()
    api = response["api"]
    count = api["results"]
    items = api["leagues"]
    return None if not (count > 0) or count != len(items) else items
Exemple #6
0
def get_leagues_season(season=0):
    url = "leagues/season/{season}"
    url = URL(url.format(season=season))
    response = requests.get(url, headers=headers)
    response = response.json()
    api = response["api"]
    count = api["results"]
    items = api["leagues"]
    return None if not (count > 0) or count != len(items) else items
Exemple #7
0
def get_stats_date(teamId=0, leagueId=0, date=None):
    format = '%Y-%m-%d'
    date = '' if not (type(date) == dt.date) else dt.strftime(date, format)
    url = "statistics/{leagueId}/{teamId}/{date}"
    url = URL(url.format(leagueId=leagueId, teamId=teamId, date=date))
    response = requests.get(url, headers=headers)
    response = response.json()
    api = response["api"]
    count = api["results"]
    items = api["statistics"]
    return None if not (count > 0) else items