uberfastman / yfpy

Python API wrapper for the Yahoo Fantasy Sports public API (supports NFL, NHL, MLB, and NBA).
https://pypi.org/project/yfpy/
GNU General Public License v3.0
163 stars 44 forks source link

[Bug] Team key does not exist (for a league I'm not even in...) #54

Open ijcd opened 4 months ago

ijcd commented 4 months ago

Description of Issue

I am using the examples from the getting started docs. When I try to list the league ids, I get this very specific error:

% python3 ./quickstart.py
2024-02-26 03:05:01.035 - ERROR - query.py - yfpy.query:205 - Attempt to retrieve data at URL https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes=nhl/teams/?format=json failed with error: "Team key 39.l.32941.t.10 does not exist."
Traceback (most recent call last):
  File "/Users/ijcd/work/fantasy/trials/yfpy/./quickstart.py", line 290, in <module>
    print(repr(yahoo_query.get_user_teams()))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yfpy/query.py", line 967, in get_user_teams
    return self.query(
           ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yfpy/query.py", line 263, in query
    response = self.get_response(url)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/yfpy/query.py", line 206, in get_response
    raise YahooFantasySportsDataNotFound(error_msg, url=response.url)
yfpy.exceptions.YahooFantasySportsDataNotFound: Attempt to retrieve data at URL https://fantasysports.yahooapis.com/fantasy/v2/users;use_login=1/games;codes=nhl/teams/?format=json failed with error: "Team key 39.l.32941.t.10 does not exist."

Additional Information as Applicable

The odd thing about this is that I'm not in this league as near as I can tell. Oddly, though, If I go to this league in NHL, I can see it, but maybe that's just because it is public. This may be a red herring.

https://hockey.fantasysports.yahoo.com/hockey/32941

Yahoo Fantasy Sports League ID

42179

Yahoo Fantasy Sports League Privacy

Private

Operating System/Environment

macOS

Other

It seems like that team ID is for something else... I think the format is Game.l.League.t.Team -- I'm not sure what game 39 is... but it seems that maybe it was MLB 2002? Something very odd is going on here -- I'm worried that there is bad data in the API for my user... no idea how it would have got there or how to fix it -- I can't seem to find this league (unless it is that NHL one... but the league id matches without the game matching...)