joeyagreco / leeger

Instant stats for any fantasy football league.
https://pypi.org/project/leeger
MIT License
57 stars 17 forks source link

Fix FleaflickerLeagueLoader: Need to specify season/year for Scoring … #99

Closed colllin closed 1 year ago

colllin commented 1 year ago

…API (or defaults to current year?)

joeyagreco commented 1 year ago

This looks good to me. I currently do not have an actual Fleaflicker league to test this on. Is this working for you with the change?

colllin commented 1 year ago

It's working for me, but also the API is not authenticated right now so you can test with this league ID: 91436

colllin commented 1 year ago

Before the change, this threw an error about "no weeks found in season":

from leeger.league_loader.FleaflickerLeagueLoader import FleaflickerLeagueLoader
from leeger.model.league import League

fleaflickerLeagueLoader = FleaflickerLeagueLoader("91436", [2022])
league = fleaflickerLeagueLoader.loadLeague()

The Fleaflicker API docs say that it defaults to the current year (2023), which of course has no weeks. After the change to specify the season in the API call, it finds the weeks and doesn't throw an error.

joeyagreco commented 1 year ago

Thank for your help!

Fixed and added multi-year support for Fleaflicker in the latest release.

I was able to get multiple years from your league into an Excel sheet using this code:

from leeger.league_loader.FleaflickerLeagueLoader import FleaflickerLeagueLoader
from leeger.util.excel import leagueToExcel

if __name__ == '__main__':
    fleaflickerLeagueLoader = FleaflickerLeagueLoader("91436", [2021, 2022])
    league = fleaflickerLeagueLoader.loadLeague()
    leagueToExcel(league, "somepath/foo.xlsx", overwrite=True)

Please let me know if you come across any other issues with Fleaflicker in this library and I'll be sure to look into them.