Splits Statcast queries to avoid request timeouts

def split_request(start_dt, end_dt, player_id, url):
    """
    Splits Statcast queries to avoid request timeouts
    """
    current_dt = datetime.datetime.strptime(start_dt, '%Y-%m-%d')
    end_dt = datetime.datetime.strptime(end_dt, '%Y-%m-%d')
    results = []  # list to hold data as it is returned
    player_id = str(player_id)
    print('Gathering Player Data')
    # break query into multiple requests
    while current_dt < end_dt:
        remaining = end_dt - current_dt
        # increment date ranges by at most 60 days
        delta = min(remaining, datetime.timedelta(days=2190))
        next_dt = current_dt + delta
        start_str = current_dt.strftime('%Y-%m-%d')
        end_str = next_dt.strftime('%Y-%m-%d')
        # retrieve data
        data = requests.get(url.format(start_str, end_str, player_id))
        df = pd.read_csv(io.StringIO(data.text))
        # add data to list and increment current dates
        results.append(df)
        current_dt = next_dt + datetime.timedelta(days=1)
    return pd.concat(results)