Update functions/pitch_summary_functions.py
Browse files1014 unmodified lines1015101610171018101910201021102210231024102510261027102810291030103110321033103410351014 unmodified linesprint(start_date,end_date)print(f'{season}-01-01',f'{season}-12-31')if (start_date_input == f'{season}-01-01' and end_date_input == f'{season}-12-31') and (season==get_current_year()):url = f"""https://www.fangraphs.com/api/leaders/major-league/data?age=&pos=all&stats=pit&lg=all&season={season}&season1={season}&startdate={start_date}&enddate={end_date}&ind=0&qual=0&type=8&month=33&pageitems=500000"""else:url = f"""https://www.fangraphs.com/api/leaders/major-league/data?age=&pos=all&stats=pit&lg=all&season={season}&season1={season}&startdate={start_date}&enddate={end_date}&ind=0&qual=0&type=8&month=1000&pageitems=500000"""data = requests.get(url).json()df = pl.DataFrame(data=data['data'], infer_schema_length=1000)return dfdef fangraphs_splits_scrape(player_input: str, year_input: int, start_date: str, end_date: str, split: str,start_date_input:str = None,1014 unmodified lines1015101610171018101910201021102210231024102510261027102810291030103110321033103410351014 unmodified linesprint(start_date,end_date)print(f'{season}-01-01',f'{season}-12-31')if (start_date_input == f'{season}-01-01' and end_date_input == f'{season}-12-31') and (season == get_current_year()):url = f"""https://www.fangraphs.com/api/leaders/major-league/data?age=&pos=all&stats=pit&lg=all&season={season}&season1={season}&startdate={start_date}&enddate={end_date}&ind=0&qual=0&type=8&month=33&pageitems=500000"""else:url = f"""https://www.fangraphs.com/api/leaders/major-league/data?age=&pos=all&stats=pit&lg=all&season={season}&season1={season}&startdate={start_date}&enddate={end_date}&ind=0&qual=0&type=8&month=1000&pageitems=500000"""data = requests.get(url).json()try:df = pl.DataFrame(data=data['data'], infer_schema_length=1000)except KeyError:# Retry with month=0 instead of 33url = f"""https://www.fangraphs.com/api/leaders/major-league/data?age=&pos=all&stats=pit&lg=all&season={season}&season1={season}&startdate={start_date}&enddate={end_date}&ind=0&qual=0&type=8&month=0&pageitems=500000"""data = requests.get(url).json()df = pl.DataFrame(data=data['data'], infer_schema_length=1000)return dfdef fangraphs_splits_scrape(player_input: str, year_input: int, start_date: str, end_date: str, split: str,start_date_input:str = None,
functions/pitch_summary_functions.py+13-13