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

add default for hockey league data['schedule']['home'] #313

Merged

Conversation

alexindaco
Copy link

I was getting the following error when doing league = League(league_id=LEAGUE_ID, year=2022, swid=SWID, espn_s2=ESPN_S2, debug=True)

Traceback (most recent call last):
  File "main.py", line 11, in <module>
    f()
  File ".../espn-api/main.py", line 7, in f
    league = League(league_id=LEAGUE_ID, year=2022, swid=SWID, espn_s2=ESPN_S2, debug=True)
  File ".../espn-api/espn_apii/hockey/league.py", line 22, in __init__
    data = self._fetch_league()
  File ".../espn-api/espn_api/hockey/league.py", line 30, in _fetch_league
    self._map_matchup_ids(data['schedule'])
  File ".../espn-api/espn_api/hockey/league.py", line 39, in _map_matchup_ids
    scoring_periods = match['home'].get('pointsByScoringPeriod', {}).keys()
KeyError: 'home'

I noticed that the code for basketball leagues was doing match.get('home', {}) instead of match['home'], so i figured the same thing needed to happen here for hockey.

@cwendt94
Copy link
Owner

Thanks for the PR, I wonder if this was introduced when the NHL postponed/canceled some games.

@codecov-commenter
Copy link

Codecov Report

Merging #313 (b0f9862) into master (5fdf2d2) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #313   +/-   ##
=======================================
  Coverage   87.82%   87.82%           
=======================================
  Files          47       47           
  Lines        1643     1643           
=======================================
  Hits         1443     1443           
  Misses        200      200           
Impacted Files Coverage Δ
espn_api/hockey/league.py 83.73% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5fdf2d2...b0f9862. Read the comment docs.

@cwendt94 cwendt94 merged commit e8fe651 into cwendt94:master Jan 20, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants