ESPN API
This package uses ESPN's Fantasy API to extract data from any public or private league for Fantasy Football and Basketball (NHL, MLB, and WNBA are in development).
Please feel free to make suggestions, bug reports, and pull request for features or fixes!
This package was inspired and based off of rbarton65/espnff.
Installing
Note
The difference in setup.py and requirements is in the test packages. If you are in python version >=3.9 then please use the requirements and pytest as nosetests is deprecated.
With Git & Setup.py (Not recommended for Python >=3.9):
git clone https://github.com/cwendt94/espn-api
cd espn-api
python3 setup.py install
with Git and Requirements.txt (Recommended for python >=3.9)
git clone https://github.com/cwendt94/espn-api
cd espn-api
python -m venv myenv
myenv\Scripts\activate.bat
pip install -r requirementsV2.txt
With pip:
pip install espn_api
Run Tests
with nosetests (Not recommended for Python >=3.9):
python3 setup.py nosetests
with pytest (Recommended for Python >=3.9)
pytest
Usage
For Getting Started and API details head over to the Wiki!
# Football API
from espn_api.football import League
# Basketball API
from espn_api.basketball import League
# Hockey API
from espn_api.hockey import League
# Baseball API
from espn_api.baseball import League
# Init
league = League(league_id=222, year=2019)
Discussions (new)
If you have any questions about the package, ESPN API data, or want to talk about a feature please start a discussion!
Issue Reporting
If you find a bug follow the steps below for reporting.
-
Open a new issue with a brief description of the bug for the title. In the title also add which sport (Football or Basketball)
-
Run the application in debug mode to view ESPN API request's and response's
# ... import statement above league = League(league_id=1245, year=2019, debug=True)
The application will print all requests and the response from ESPN's API in the console. I would suggest piping the console output to a text file as it will be a lot of data.
-
Find the last log before the crash and copy it in the issue descrption with the line number of the crash or possible bug.
-
Submit the new issue!
I will try to comment on the issue as soon as possible with my thoughts and possible fix!
Release files for espn-api 0.46.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| espn_api-0.46.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / espn_api-0.46.0-py3-none-any.whl
| Download URL | espn_api-0.46.0-py3-none-any.whl |
|---|---|
| Size | 69.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3d3f6f5cb857a8478ffdc9da078031f54adb74270e6508d2e530f6b15331ce2
|
|
BLAKE2b-256 checksum How to use checksums |
71dd21f83360f1e105de2016c1ffa2793eb792db168b2159d7f57ffd39bf411c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 23, 2026.
Transparency log