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

summary.get_teamstats() doesn't work as intended when season parameter is not provided, but defense=True #12

Closed
esqew opened this issue Jan 13, 2022 · 2 comments

Comments

@esqew
Copy link
Collaborator

esqew commented Jan 13, 2022

A small typo in summary.py builds the URL just slightly incorrectly, which causes a 404 Not Found to be returned by the server when the HTTP request is executed. This logic seems it would only hit when calling kenpompy.summary.get_teamstats() without providing a value for the season parameter, but explicitly specifying defense=True.

(I'll be submitting a PR momentarily to fix this.)

Reproduction

Code

import kenpompy.utils as kp
import kenpompy.summary as kp_s

browser = kp.login('[email protected]', 'valid_password')
summary = kp_s.get_teamstats(browser, defense=True)

Expected behavior

The code retrieves the page containing the defensive team statistics and parses it into a DataFrame object.

Actual behavior

The code attempts to find the relevant table element in the DOM, but is unsuccessful (since the table doesn't exist in the 404 document) and throws IndexError: list index out of range at summary.py:155.

@j-andrews7
Copy link
Owner

Pretty sure this is the same as #7, which I thought I had fixed but apparently not. I'll take a look when I get a chance, thanks for the PR.

@esqew
Copy link
Collaborator Author

esqew commented Jan 26, 2022

My pleasure -thanks for the great library!

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