https://github.com/bcanfield/southpaw
Python Fanduel API - Lineup Automation
https://github.com/bcanfield/southpaw
dfs fanduel generator lineup optimizer python
Last synced: 13 days ago
JSON representation
Python Fanduel API - Lineup Automation
- Host: GitHub
- URL: https://github.com/bcanfield/southpaw
- Owner: bcanfield
- Created: 2021-06-07T04:16:26.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-18T05:20:57.000Z (over 1 year ago)
- Last Synced: 2025-04-17T22:02:30.751Z (about 1 month ago)
- Topics: dfs, fanduel, generator, lineup, optimizer, python
- Language: Python
- Homepage: https://pypi.org/project/southpaw
- Size: 174 KB
- Stars: 55
- Watchers: 3
- Forks: 2
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

[](https://pypi.org/project/southpaw/)
**Southpaw** is a python package that provides access to the Fanduel API.
Optimize your DFS experience by programmatically retrieving and updating your lineups, analyzing your data, and more.
[API Documentation](https://bcanfield.github.io/southpaw/)
# Installation
```
python -m pip install southpaw
```# Setup
**UPDATE (October 2023):****Fanduel has cracked down on automated methods of logging in and now requires two-factor auth - so this process now takes an extra initial step now to retrieve the auth headers.**
## How to retrieve your auth headers
1. Go to [Fanduel DFS](https://www.fanduel.com/contests) and log in.
2. Open up your browser inspector, toggle the Network tab, and refresh the page to view the requests.
4. You need to find one of the requests that is being sent to **https://api.fanduel.com**. Some examples are **fixture-lists?** and **current?**
5. In the **Response Headers** section, copy out the **Authorization** header and **X-Auth-Token**. Reference my screenshot below.*Note: The x-auth-token expires. So you will have to repeat the method above when it does*
## Start having fun
You first must initialize your Fanduel object using your email, password, and auth tokens. You will see a success message if you succesfully authenticate.```
import southpawbasic_auth_token = 'Basic GBGskzdmGLKOP5EwMDNkNGUaLkFdM2VjKJHDNmY1Mjc6'
x_auth_token = 'eyasdffdsaasjhkdfbfkhdsbakjbasdkjfbnfkjdsaetgdffgdfdgs'
fanduel_email = '[email protected]'
fanduel_password = 'fakeFanduelPassword'fd = southpaw.Fanduel(fanduel_email, fanduel_password, basic_auth_token, x_auth_token
```
You now have access to all of the data that Fanduel offers by using a rich set of helper functions that Southpaw provides.## Examples
[Full Documentation](https://bcanfield.github.io/southpaw/)
It's easy to get overwhelmed with the amount of helper functions available and how to use them effectively.
See the **'Quick Start'** section below to get you up and running as quickly as possible.
## Quick Start
Get a list of all currently entered contests and all relevant info.*FYI: If you are not entered into any Fanduel contests you will not get any back*
```
# Get a list of all currently entered contests
contests = fd.easy_get_contests()# Are we entered in any contests?
if len(contests) > 0:
# Grab the first contest for now
# You could filter by sport or name
contest = contests[0]
print("Contest: ", contest["name"], contest["sport"], contest["salary_cap"])
# Get entries in this contest
entries = contests[0]["entries"]
for entry in entries:
print("Entry: ", entry["id"])
print("Entry Required Lineup Format:", fd.get_roster_format_in_entry(entry["id"]))
# Get players available to choose for this entry
print("Available Players: ", len(entry["available_players"]))# From here we have the contest info, required lineup format, and available players.
# We have everything we need to smartly update some entries# Just blindly taking first 5 players as an example
players_to_use = available_players[:5]
update_entry_input = [UpdateEntryInput({'id': entry["id"], 'lineup': players_to_use})]
```
## DisclaimerThis project is for educational use only.
Accumulating Fanduel points or prizes through unauthorized methods such as unauthorized scripts or other automated means is against the Fanduel terms and may result in account disqualification.
The contributors of Southpaw shall not be held responsible for any actions taken using this tool.
## Developing
Build package locally:
`python setup.py bdist_wheel`Install package locally:
`pip install dist/southpaw-<...>.whl --force-reinstall`