Open srednasykcin opened 1 year ago
The classes defined in this package are not subscriptable, which means you won't be able to use the square brackets to reference variables of the class (i.e box[0][var]
).
All the variables and information about each class is defined in the repo wiki which should allow you to directly call variables you would like to use.
After printing out a list of all the variables for a H2HCategoryBoxScore object, I got the list shown below (variables). I then attempted to have each of these variables print via for loop but get:
" AttributeError: 'H2HCategoryBoxScore' object has no attribute 'var' "
You can see print tests in the code below that I ran successfully, but for some reason when inputting these attributes via for loop iterating through a list, I get this AttributeError. I humbly ask, has anyone seen this before?
week = 3 league = League(league_id=197496, year=2023, espn_s2=espn_s2, swid=SWID) box = league.box_scores(matchup_period=week, scoring_period=week, matchup_total=True)
team = league.teams[0] player = team.roster[0]
print(box[0].dict)
variables = ['winner', 'home_team', 'home_wins', 'home_ties', 'home_losses', 'home_stats', 'away_team', 'away_wins', 'away_ties', 'away_losses', 'away_stats', 'home_lineup', 'away_lineup']
for var in variables: print(var) print(box[0].var)