Yfpy
Python API wrapper for the Yahoo Fantasy Sports public API (supports NFL, NHL, MLB, and NBA).
Install / Use
/learn @uberfastman/YfpyREADME
YFPY - Yahoo Fantasy Sports API Wrapper
Python API wrapper for the Yahoo Fantasy Sports public API
Author: Wren J. R. (uberfastman)
<sub>Do you like the YFPY API wrapper? Star the repository on GitHub and please consider helping support its ongoing development:</sub>
<img src="https://github.com/uberfastman/yfpy/raw/main/resources/images/donate-paypal.png" width="75"/> <img src="https://github.com/uberfastman/yfpy/raw/main/resources/images/donate-bitcoin.png" width="75"/> <img src="https://github.com/uberfastman/yfpy/raw/main/resources/images/donate-ethereum.png" width="75"/>
| <sub><sup>Cryptocurrency</sup></sub> | <sub><sup>Address</sup></sub> |
|----------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------:|
| <sub><sup>Bitcoin (BTC)</sup></sub> | <sub><sup>bc1qataspvklhewtswm357m0677q4raag5new2xt3e</sup></sub> |
| <sub><sup>Ethereum (ETH)</sup></sub> | <sub><sup>0x5eAa522e66a90577D49e9E72f253EC952CDB4059</sup></sub> |
<sub><sup></sup></sub>
READ THE DOCS HERE! <br/> <sup>Detailed documentation on YFPY can be found at https://yfpy.uberfastman.com.</sup>
Table of Contents
<a name="about"></a>
About
YFPY is a comprehensive wrapper around the Yahoo Fantasy Sports API. It allows for easy retrieval and parsing of almost any data you might wish to extract and use from any Yahoo fantasy league to which your Yahoo account has access (or for public leagues). The primary focus of this wrapper is on fantasy football (NFL), but it also supports usage with fantasy hockey (NHL), fantasy baseball (MLB), and fantasy basketball (NBA).
<a name="installation"></a>
Installation
<a name="pip"></a>
Pip
-
If you wish to use YFPY within another project, from within your project directory, run:
pip install yfpyor add
yfpyto your projectrequirements.txt.
<a name="uv"></a>
uv
-
If you wish to use YFPY within another project, from within your project directory, run:
uv add yfpyor add
yfpyto the projectdependenciessection in yourpyproject.toml.
<a name="manual"></a>
Manual
- If you wish to download and use YFPY locally, clone the git repository:
git clone git@github.com:uberfastman/yfpy.git
<a name="setup"></a>
Setup
<a name="yahoo-developer-network-app"></a>
Yahoo Developer Network App
In order to use YFPY with private fantasy leagues, you must set up an app on your Yahoo account to allow access. Follow the step-by-step guide below for instructions on how to do so, or see Getting Started in the Yahoo Developer Network docs for more details.
Note: If you are only planning on using YFPY to pull "read only" data from public leagues, you do not need to do this.
- Log in to a Yahoo account with access to whatever fantasy leagues from which you wish to retrieve data.
- Go to https://developer.yahoo.com/apps/create/ and create an app (you must be logged into your Yahoo account as stated above). For the app, select the following options:
Application Name(Required):yfpy(you can name your app whatever you want, but this is just an example).Application Type(Required): select theInstalled Applicationradio button.Description(Optional): you may write a short description of what the app does.Home Page URL(Optional): if you have a web address related to your app you may add it here.Redirect URI(s)(Required): this field must contain a valid redirect address, so you can usehttps://localhost:8080API Permissions(Required): check theFantasy Sportscheckbox. You can leave theReadoption selected (appears in an accordion expansion underneath theFantasy Sportscheckbox once you select it).- Click the
Create Appbutton. - Once the app is created, it should redirect you to a page for your app, which will show both a
Client IDand aClient Secret. - Copy the
Client IDandClient Secretand proceed with the steps in Environment Variables or Programmatic Persistent Authentication.
<a name="environment-variables"></a>
Environment Variables
YFPY now supports the usage of environment variables, either directly within the command line or using a .env file. Any environment variables exported to the same shell in which YFPY runs will automatically be read when a YahooFantasySportsQuery object is instantiated when env_var_fallback=True (default).
- If you wish to also use environment variables stored in a
.envfile, you can set up a.envfile by making a copy of.env.templatein the root project directory and renaming it.env(you can do this in the command line by runningcp .env.template .env). - Paste the
Client IDandClient Secretretrieved by following the steps in Yahoo Developer Network App into their respective environment variables in your.envfile:
YAHOO_CONSUMER_KEY=<YAHOO_DEVELOPER_APP_CONSUMER_KEY_STRING>
YAHOO_CONSUMER_SECRET=<YAHOO_DEVELOPER_APP_CONSUMER_SECRET_STRING>
- YFPY is configured by default to check for environment variables for authentication with Yahoo, so you will now be able to proceed directly to Authentication.
Note: You can disable the fallback to environment variables behavior during instantiation of a YFPY query by passing the argument env_var_fallback=False to the object:
from yfpy.query import YahooFantasySportsQuery
query = YahooFantasySportsQuery(
league_id="<YAHOO_LEAGUE_ID>",
game_code="nfl",
game_id=449,
yahoo_consumer_key="<YAHOO_CONSUMER_KEY>",
yahoo_consumer_secret="<YAHOO_CONSUMER_SECRET>",
env_var_fallback=False
)
<a name="usage"></a>
Usage
<a name="authentication"></a>
Authentication
- Follow the instructions in the Installation and Setup sections.
- The first time you use YFPY, a browser window will open up asking you to allow your app to access your Yahoo fantasy sports data. You MUST hit allow, and then copy the verification code that pops up into the command line prompt where it will now be asking for verification, hit enter, and the OAuth2 three-legged handshake should be complete and your data should have been successfully retrieved.
Note: *If you are running YFPY in Docker, instead of opening a new browser window, YFPY will output a URL to the command line, which you must then copy to a br
Related Skills
claude-opus-4-5-migration
84.5kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
341.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
openhue
341.2kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
341.2kElevenLabs text-to-speech with mac-style say UX.
