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] function attribute not working correctly get_game_metadata_by_game_id(game_id).game_key #50

Closed hkingsley closed 6 months ago

hkingsley commented 6 months ago

Description of Issue

function attribute not working correctly get_game_metadata_by_game_id(game_id).game_key

so unable to use query.get_league_info()

Yahoo Fantasy Sports League ID

122731

Yahoo Fantasy Sports League Privacy

Public

Operating System/Environment

Ubuntu

Other

Any other setup/environment/configuration information you might deem potentially relevant. Screenshot 2023-12-07 153357

hkingsley commented 6 months ago

looks like its affecting more than just query.get_league_info() also query.get_league_standings() Screenshot 2023-12-07 154212

uberfastman commented 6 months ago

Hi @hkingsley, thanks for the bug report. With the latest major version release of YFPY, I made a change in how you set up the YahooFantasySportsQuery object such that it now requires you to provide the game_code as part of instantiation. You can use nfl, mlb, nhl, or nba for the respective sports. What I'm guessing is happening though is if you didn't provide that positional argument but then had subsequent arguments, then the new class signature was picking up a value set for all_output_as_json_str, which would trigger it to be True, and thus all of our output would be converted to JSON strings instead of YFPY objects.

If you can show me how you were instantiating your YahooFantasySportsQuery object I can confirm if my suspicions are correct. I tried running all of the above methods with your league and had no issues retrieving the info as expected, so I think it might just be an issue with the setup due to that change I made in this last major version release.

hkingsley commented 6 months ago

@uberfastman Thank you for getting back to me! This is how i've instantiated YahooFantasySportsQuery image

uberfastman commented 6 months ago

Ah phew, I was worried for a moment that something was broken. You need to just set all_output_as_json_str=False (or just exclude it as it defaults to False) and you should be all set.

I'm closing this but if anything persists just reopen it and add a comment!

hkingsley commented 6 months ago

@uberfastman Thank you all sorted

uberfastman commented 6 months ago

Great, glad it's sorted! Thanks for using YFPY!