Skip to content

SouthPaw021/ESPN-Fantasy-API

 
 

Repository files navigation

espn-ff-api

Forked form the initial work of jman4190 Link to Blog Post

How to Access the Unofficial ESPN Fantasy Footbball API with Python to pull League Draft History and upcoming season player projections. For use with ESPN Auction Leagues

Note: ESPN's API changed in 2024 and the new API URL has been swapped into the code where needed

Requirements

  • pandas
  • requests
  • espn fantasy football account
  • python-dotenv

Storing Environment Variables

Create a .env file and add the following

export LEAGUE_ID = 'YOU_LEAGUE_ID_HERE'
export SWID_COOKIE = "YOUR_SWID_COOKIE_HERE"
export ESPN_S2_COOKIES = "YOUR_ESPN_S2_COOKIE_HERE"

Modifying Variables

Make sure to update your league_id and adjust the years and league owners lists in static.py Also update projection_year in static.py to grab projections for the upcoming season

Running the script

After you have updated both files, run the following:
$ python draft_history.py
$ projection.history.py

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 99.1%
  • Python 0.9%