mattdodge / yahoofantasy

A Python SDK for the Yahoo! Fantasy Sports API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLI dump matchups for NFL 2022 season yields "ValueError: 2022 is not a valid season for nfl"

oconnorac opened this issue · comments

commented

I entered the following commands using the CLI:

yahofantasy dump matchups

I then entered nfl and 2022, and received the following error:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/yahoofantasy", line 8, in <module>
    sys.exit(yahoofantasy())
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1654, in invoke
    super().invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/yahoofantasy/cli/dump.py", line 23, in dump
    leagues = yf_context.get_leagues(game, season)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/yahoofantasy/context.py", line 106, in get_leagues
    game_id = get_game_id(game, season)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/yahoofantasy/api/games.py", line 79, in get_game_id
    raise ValueError(
ValueError: 2022 is not a valid season for nfl

Recommended fix: pull the Yahoo! Fantasy 2022 NFL game codes and add it to line 50 as:

games['nfl']['2022'] = <yahoo game_code here>

Fixed in version 1.2.3, thanks for pointing that out!

To upgrade:

pip install -U yahoofantasy
commented

You're awesome, thank you! Would've found the game_code myself but the Yahoo! Fantasy API has been so difficult to work with, hence using your wrapper for it. Great work!