# sleeper_fantasy_api
An object-oriented Python wrapper for the [Sleeper Fantasy Football API](https://docs.sleeper.com/), designed to simplify working with data on users, leagues, transactions, and more.
The Sleeper API is currently read-only.
H/T to other repos who created similar functions before me:
- [sleeper-api-wrapper](https://github.com/dtsong/sleeper-api-wrapper)
- [sleeper-py](https://github.com/AdamCurtisVT/sleeper-py)
## Table of Contents
- [Overview](#overview)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Endpoints](#endpoints)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)
## Overview
This project simplifies accessing the Sleeper API, allowing users to easily fetch player stats, league data, transactions, and more in an object-oriented manner. The wrapper supports complex queries using `AND` and `OR` logic, with a focus on easy integration and flexibility.
## Features
- Fetching player stats, leagues, and transactions.
- Supports advanced player search logic (e.g., `AND`/`OR` conditions).
- Object-oriented design for ease of use and integration.
Planned features:
- Custom setting of CONVERT_RESULT global variable by user
## Installation
To install locally, follow these steps:
### Prerequisites:
- Python 3.10
### Installation:
```bash
git clone https://github.com/smallery/sleeper_fantasy_api.git
cd sleeper_fantasy_api
pip install -r requirements.txt
```
## Usage:
There are many uses for this repo, some examples are included in ./examples that you can run from the commandline:
For basic usage, getting user info:
```bash
python3 examples/example_basic_usage.py -u [YOUR_USERNAME]
```
For mode advanced usage gather user, league, draft, and player data:
```bash
python3 examples/example_advanced_usage.py -u [YOUR_USERNAME]
```
For basic to advanced usage of access the player database:
```bash
python3 examples/example_player_endpoint_search_queries.py
```
## Endpoints
The current endpoints available through the API are the following:
- **Draft Endpoint**:
- `draft_endpoint`: Retrieve information about a draft (picks, users, trades) with a given draft_id.
- **League Endpoint**:
- `league_endpoint`: Retrieve information on leagues with a given league_id.
- **Player Endpoint**:
- `player_endpoint`: Retrieve the database of players from Sleeper along with key attributes.
This endpoint has built in caching to store the player data locally to avoid excessive API calls.
From current docs, it is expected to call the player_endpoint for all players more than once per day.
- **User Endpoint**:
- `user_endpoint`: Retrieve information about a user using their username or user_id.
For more details, refer to the full [Sleeper API documentation](https://docs.sleeper.com/#introduction).
## Contributing
Contributions are welcome! Please follow the guidelines below:
- Fork the repository.
- Create a new branch (`git checkout -b githubUsername/feature-branch`).
- Submit a pull request.
## License
This project is licensed under the MIT License. See the `LICENSE` file for more information.
## Contact
If you have any questions or issues, please contact [Sam Mallery](mailto:sleeperfantasyapi@gmail.com).
Raw data
{
"_id": null,
"home_page": null,
"name": "sleeper-fantasy-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Samuel Mallery <mallerysam@gmail.com>",
"keywords": "sleeper, fantasy football, football, nfl, sleeper api, fantasy",
"author": null,
"author_email": "Samuel Mallery <mallerysam@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/bb/69/e93c3e2891b0efe5c9ace9fcf5a8a8d120641f99da1c5ae38588cc215249/sleeper_fantasy_api-0.1.0.tar.gz",
"platform": null,
"description": "# sleeper_fantasy_api\n\nAn object-oriented Python wrapper for the [Sleeper Fantasy Football API](https://docs.sleeper.com/), designed to simplify working with data on users, leagues, transactions, and more.\n\nThe Sleeper API is currently read-only.\n\nH/T to other repos who created similar functions before me:\n- [sleeper-api-wrapper](https://github.com/dtsong/sleeper-api-wrapper)\n- [sleeper-py](https://github.com/AdamCurtisVT/sleeper-py)\n\n## Table of Contents\n- [Overview](#overview)\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Endpoints](#endpoints)\n- [Contributing](#contributing)\n- [License](#license)\n- [Contact](#contact)\n\n## Overview\nThis project simplifies accessing the Sleeper API, allowing users to easily fetch player stats, league data, transactions, and more in an object-oriented manner. The wrapper supports complex queries using `AND` and `OR` logic, with a focus on easy integration and flexibility.\n\n## Features\n- Fetching player stats, leagues, and transactions.\n- Supports advanced player search logic (e.g., `AND`/`OR` conditions).\n- Object-oriented design for ease of use and integration.\n \nPlanned features:\n- Custom setting of CONVERT_RESULT global variable by user\n\n## Installation\nTo install locally, follow these steps:\n\n### Prerequisites:\n- Python 3.10\n\n### Installation:\n```bash\ngit clone https://github.com/smallery/sleeper_fantasy_api.git\ncd sleeper_fantasy_api\npip install -r requirements.txt\n```\n\n## Usage:\nThere are many uses for this repo, some examples are included in ./examples that you can run from the commandline:\nFor basic usage, getting user info:\n```bash\npython3 examples/example_basic_usage.py -u [YOUR_USERNAME]\n```\nFor mode advanced usage gather user, league, draft, and player data:\n```bash\npython3 examples/example_advanced_usage.py -u [YOUR_USERNAME]\n```\nFor basic to advanced usage of access the player database:\n```bash\npython3 examples/example_player_endpoint_search_queries.py\n```\n\n## Endpoints\nThe current endpoints available through the API are the following:\n\n- **Draft Endpoint**:\n - `draft_endpoint`: Retrieve information about a draft (picks, users, trades) with a given draft_id.\n\n- **League Endpoint**:\n - `league_endpoint`: Retrieve information on leagues with a given league_id.\n \n- **Player Endpoint**:\n - `player_endpoint`: Retrieve the database of players from Sleeper along with key attributes.\n This endpoint has built in caching to store the player data locally to avoid excessive API calls.\n From current docs, it is expected to call the player_endpoint for all players more than once per day.\n \n- **User Endpoint**:\n - `user_endpoint`: Retrieve information about a user using their username or user_id.\n\nFor more details, refer to the full [Sleeper API documentation](https://docs.sleeper.com/#introduction).\n\n## Contributing\nContributions are welcome! Please follow the guidelines below:\n- Fork the repository.\n- Create a new branch (`git checkout -b githubUsername/feature-branch`).\n- Submit a pull request.\n\n## License\nThis project is licensed under the MIT License. See the `LICENSE` file for more information.\n\n## Contact\nIf you have any questions or issues, please contact [Sam Mallery](mailto:sleeperfantasyapi@gmail.com).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python wrapper for the Sleeper Fantasy API",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/smallery/sleeper_fantasy_api",
"Issues": "https://github.com/smallery/sleeper_fantasy_api/issues"
},
"split_keywords": [
"sleeper",
" fantasy football",
" football",
" nfl",
" sleeper api",
" fantasy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d2f808462014029ef766f9338fc8ca4d93dc988a46c0f9d77b078bd94dc18723",
"md5": "ede3483ce84b1542d71db8f54ccb0b72",
"sha256": "21a715255872ee37a9393031867b2273ebd1b6802c83c390f9cad9e2ac437703"
},
"downloads": -1,
"filename": "sleeper_fantasy_api-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ede3483ce84b1542d71db8f54ccb0b72",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 24742,
"upload_time": "2024-09-27T22:12:48",
"upload_time_iso_8601": "2024-09-27T22:12:48.754374Z",
"url": "https://files.pythonhosted.org/packages/d2/f8/08462014029ef766f9338fc8ca4d93dc988a46c0f9d77b078bd94dc18723/sleeper_fantasy_api-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb69e93c3e2891b0efe5c9ace9fcf5a8a8d120641f99da1c5ae38588cc215249",
"md5": "c14663ea868e791216c9ed707fe1053f",
"sha256": "f9b246710a3d3759ec41809ea611ab4ae6002f5d9adcac2c31271f9c0bdeee8c"
},
"downloads": -1,
"filename": "sleeper_fantasy_api-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "c14663ea868e791216c9ed707fe1053f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 52241,
"upload_time": "2024-09-27T22:12:49",
"upload_time_iso_8601": "2024-09-27T22:12:49.843142Z",
"url": "https://files.pythonhosted.org/packages/bb/69/e93c3e2891b0efe5c9ace9fcf5a8a8d120641f99da1c5ae38588cc215249/sleeper_fantasy_api-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-27 22:12:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "smallery",
"github_project": "sleeper_fantasy_api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "platformdirs",
"specs": [
[
"==",
"3.8.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"8.2.2"
]
]
}
],
"lcname": "sleeper-fantasy-api"
}