INNER CODE UNIT · Python
output
mhaythornthwaite/Football_Prediction_Project · 01_api_data_request.py:65
output = pd.read_json(json_data_path + json_data, orient=orient_def)
return output
#---------------------------- REQUESTING BASIC DATA ---------------------------
base_url = 'https://v2.api-football.com/'
def req_prem_fixtures_id(season_code, year=YEAR_str):
#request to the api for the data
premier_league_fixtures_raw = get_api_data(base_url, f'/fixtures/league/{season_code}/')
#cleaning the data in preparation for loading into a dataframe
premier_league_fixtures_sliced = slice_api(premier_league_fixtures_raw, 33, 2)
#saving the clean data as a json file
save_api_output(f'{year}_premier_league_fixtures', premier_league_fixtures_sliced, json_data_path = 'prem_clean_fixtures_and_dataframes/')