Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting index out of range issues on get_schedule #103

Open
jgpayne opened this issue Nov 14, 2024 · 2 comments
Open

Getting index out of range issues on get_schedule #103

jgpayne opened this issue Nov 14, 2024 · 2 comments

Comments

@jgpayne
Copy link

jgpayne commented Nov 14, 2024

Running

df = kpt.get_schedule(browser=browser, team='Kansas') or any team

I am getting the error:
url = url + "&y=" + str(season)
schedule = BeautifulSoup(get_html(browser, url), "html.parser")
table = schedule.find_all('table')[1]
schedule_df = pd.read_html(StringIO(str(table)))
IndexError: list index out of range

I am only getting this error on occasion, but when running this for multiple teams, it could happen at any moment.

@j-andrews7
Copy link
Owner

I've been unable to reproduce this. Can you post the full code chunk where you've hit this?

My initial guess is that it's a Cloudflare challenge due to many requests in a short time frame.

@jgpayne
Copy link
Author

jgpayne commented Nov 15, 2024

teams = ['Kansas', 'Connecticut', 'Kentucky', 'LSU', 'Oklahoma', 'Texas', 'SMU', 'Baylor', 'UCLA', 'Wake Forest']
for i in teams:
df = kpt.get_schedule(browser=browser, team=i)

Here is minimal code to reproduce, It doesn't happen every time, but happen on the first time I ran this code. Should I sleep after each loop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants