summary.get_teamstats() doesn't work as intended when season parameter is not provided, but defense=True
Closed this issue · 2 comments
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('valid_email@provider.domain', '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
.
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.
My pleasure -thanks for the great library!