Skip to main content

SleeperClient

A small Python client library for the Sleeper fantasy football API.

It wraps Sleeper's public, read only endpoints. The API needs no authentication or API key. Each method returns the a requests.Response object, so you'll have to handle status codes and JSON decoding yourself.

Installation

Requires Python 3.10+.

pip install sleeperclient

Usage

from sleeperclient import SleeperClient

client = SleeperClient()  # or SleeperClient(timeout=30); the default is 10 seconds

# Look up a user by username (or by user_id)
resp = client.get_user(username="some_username")
user = resp.json()

# List that user's NFL leagues for a season
leagues = client.get_user_leagues(user["user_id"], season="2026").json()

# Get the rosters in the first league
rosters = client.get_league_rosters(leagues[0]["league_id"]).json()

Available methods

Method Endpoint
get_user(user_id=None, username=None) GET /user/<user_id or username>
get_user_leagues(user_id, season) GET /user/<user_id>/leagues/nfl/<season>
get_avatar(avatar_id, thumbnail=False) GET https://sleepercdn.com/avatars[/thumbs]/<avatar_id> (returns image data)
get_league(league_id) GET /league/<league_id>
get_league_rosters(league_id) GET /league/<league_id>/rosters
get_league_users(league_id) GET /league/<league_id>/users
get_league_matchups(league_id, week) GET /league/<league_id>/matchups/<week>
get_league_playoff_bracket(league_id, winner=True) GET /league/<league_id>/winners_bracket or /losers_bracket
get_league_transactions(league_id, week) GET /league/<league_id>/transactions/<week>
get_traded_picks(league_id) GET /league/<league_id>/traded_picks
get_state(sport) GET /state/<sport>
get_drafts_for_user(user_id, season, sport="nfl") GET /user/<user_id>/drafts/<sport>/<season>
get_drafts_for_league(league_id) GET /league/<league_id>/drafts

All endpoints except get_avatar are relative to https://api.sleeper.app/v1. See the Sleeper API docs for the shape of each response.

Development

You'll need Poetry.

git clone https://github.com/Jordan-M-Young/SleeperClient.git
cd SleeperClient
poetry install

To try the client against the live API:

poetry run python examples/basic_usage.py <league_id>

Lint and format with Ruff:

poetry run ruff check .
poetry run ruff format .

License

Apache 2.0. See LICENSE.

Metadata

Release files for sleeperclient 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sleeperclient 0.1.0
File Size Uploaded Provenance Actions
sleeperclient-0.1.0.tar.gz 8.2 kB Without provenance Details for sleeperclient-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sleeperclient 0.1.0
File Interpreter ABI Platform Actions
sleeperclient-0.1.0-py3-none-any.whl Python 3 none any Details for sleeperclient-0.1.0-py3-none-any.whl

Total release size: 17.4 kB

Release files / sleeperclient-0.1.0.tar.gz

Download URL sleeperclient-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4eb52dcaa9d43d8baa13df05d623772f65c5b63890e4ee9265117b3b0deba00b
BLAKE2b-256 checksum
How to use checksums
41e3d0547d3ca8fe7e55783e76a9a5b41dc9aa12c65b767517c80111715a41f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.13.5 Darwin/25.6.0

Release files / sleeperclient-0.1.0-py3-none-any.whl

Download URL sleeperclient-0.1.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5a764bdc4ce1792029cba5ed4c81129e49159bd757f512b681d9658deaa122c
BLAKE2b-256 checksum
How to use checksums
f83d4ab33e03f5df294c26ae36f918fba279158a92ab51d1911e9a5cd5a41818
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.13.5 Darwin/25.6.0

Security for sleeperclient 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page