Package: leeger
Instant stats for any fantasy football league.Table of ContentsOverviewQuickstart GuideFAQInstallationSupported League LoadersStats ExplainedRunning TestsContributingLicenseCreditOverviewThis library allows you to take data from an existing fantasy football league and get instant stats from that league
into either a Python script or an Excel spreadsheet.This library supports multiple fantasy sites AND manual league data input.Python stats will be stored in these objects:AllTimeStatSheetYearStatSheetExcel sheets will include:A tab for each year with team statsA tab for each year with matchup infoA tab for all-time with team statsA tab for all-time with matchup infoA tab for all-time with owner statsThe main idea behind this library is:Load stats into a League objectPass this League object into various library methods to extract statsFor guides on how to use this library, see the information
underSupported League Loadersand
in theexamplefolder.Quickstart Guide1. Download PythonDownload the latestsupportedversion of Pythonhere.Currently, Python version 3.10+ is supported2. Create a basic Python file to use this libraryCreate a file that ends in the extension ".py"Example:my_script.py3. Download this libraryNavigate in your terminal to the directory where you created your Python script in Step 2Run the commandpip install leegerIf you do not havepipinstalled, you will need to install it4. Download your league data using a league loaderFind the site/s you use for fantasy footballhereFollow theSetup DocumentationOnce you have everything you need for your selected site/s, use the code examples
foundherefor your specific site/s to
download your league dataYou can put the code inside the Python script you created in Step 2If you have leagues that are continued in multiple sites, you can pull from multiple sites and add the League objects
together to combine the different sitesAn example of this can be
foundhere5. Run your scriptNavigate in your terminal to the directory where you created your Python script in Step 2Run the commandpy my_script.pyReplacemy_script.pywith whatever you named your script in Step 26. Load your league stats into ExcelSlightly alter your script from Step 2 to include a function call to load your league stats into ExcelFollowthis exampleMake sure that you are passing the League object that you pulled from the league loader/s into the function call to
put your stats into ExcelFAQQuestion:I'm getting this error when I run my script:TypeError:dataclass()gotanunexpectedkeywordargument'kw_only'Answer:This error occurs when the Python version you are using is not 3.10 or greater.Make sure you are using Python version 3.10 or a newer version.Q:How do I use this library to pull stats from my online fantasy league?A:Find your fantasy sitehereand ensure you have
everything you need for the site you are usingFollow theexample code snippetsfor your
fantasy site to load the League objectQ:How can I get stats into Excel once I have my League object?A:Followthis example code.Q:Can I combine years from different fantasy sites that are loaded as separate League objects into a single League object?A:Yes, the League object supports addition (+) to combine multiple league objects.An example of this can be
foundhere.Q:Can I disable validation on my League object?A:Yes. While it is not recommended that you disable this, as validation ensures the stats are calculated properly,
disabling validation can be done by passingvalidate=Falseinto any method that takes a League object OR anyloadLeague()method from a League Loader.InstallationUse the package managerpipto install.pipinstallleegerSupported League LoadersSites that you can automatically load your league data from.NameWebsiteSupportedSetup DocumentationESPNhttps://www.espn.com/fantasy/football/:heavy_check_mark:ESPN :page_facing_up:Fleaflickerhttps://www.fleaflicker.com/:heavy_check_mark:Fleaflicker :page_facing_up:MyFantasyLeaguehttp://home.myfantasyleague.com/:heavy_check_mark:MyFantasyLeague :page_facing_up:NFLhttps://fantasy.nfl.com/:x::x:Sleeperhttps://sleeper.com/fantasy-football/:heavy_check_mark:Sleeper :page_facing_up:Yahoohttps://football.fantasysports.yahoo.com/:heavy_check_mark:Yahoo :page_facing_up:If a fantasy site you use is not listed here and you would like it to be, pleaseopen an issue.Stats ExplainedStats used in this library are
documentedhere.ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.DevelopmentRun these commands from the root folderFormat Code:./main fmtRun Unit Tests:./main testGenerate Coverage Report:./main covRunning TestsRun the following command from the root folder:pytestLicenseMITCreditESPN APIESPN Private LeaguesfleaflickerpymflsleeperYahooFantasy