{ "info": { "author": "Swapnik Katkoori", "author_email": "katkoor2@msu.edu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.7" ], "description": "[![Build Status](https://travis-ci.org/SwapnikKatkoori/sleeper-api-wrapper.svg?branch=master)](https://travis-ci.org/SwapnikKatkoori/sleeper-api-wrapper)\n![GitHub](https://img.shields.io/github/license/SwapnikKatkoori/sleeper-api-wrapper.svg?color=blue)\n![GitHub issues](https://img.shields.io/github/issues/SwapnikKatkoori/sleeper-api-wrapper.svg?color=orange)\n![PyPI](https://img.shields.io/pypi/v/sleeper-api-wrapper)\n# sleeper-api-wrapper\nA Python API wrapper for Sleeper Fantasy Football, as well as tools to simplify data recieved. It makes all endpoints found in the sleeper api docs: https://docs.sleeper.app/ available and turns the JSON response recieved into python types for easy usage.\n\n\n# Table of Contents\n\n1. [ Installation ](#install)\n\n2. [Usage](#usage)\n\n * [League](#league)\n * [Initialize](#league_initialize)\n * [get_league()](#get_league)\n * [get_rosters()](#get_rosters)\n * [get_users()](#get_users)\n * [get_matchups()](#get_matchups)\n * [get_playoff_winners_bracket()](#get_playoff_winners_racket)\n * [get_playoff_losers_bracket()](#get_playoff_losers_racket)\n * [get_transactions()](#get_transactions)\n * [get_traded_picks()](#get_traded_picks)\n * [get_all_drafts()](#get_all_drafts)\n * [get_standings()](#get_standings)\n * [get_scoreboards()](#get_scoreboards)\n * [get_close_games()](#get_close_games)\n * [User](#user)\n * [Initialize](#user_initialize)\n * [get_user()](#get_user)\n * [get_all_leagues()](#get_all_leagues)\n * [get_all_drafts()](#get_all_drafts)\n * [get_username()](#get_username)\n * [get_user_id()](#get_user_id)\n * [Stats](#stats)\n * [Initialize](#stats_initialize)\n * [get_all_stats()](#get_all_stats)\n * [get_week_stats()](#get_week_stats)\n * [get_all_projections()](#get_all_projections)\n * [get_week_projections()](#get_week_projections)\n * [get_player_week_score()](#get_player_week_score)\n * [Players](#players)\n * [Initialize](#players_initialize)\n * [get_all_players()](#get_all_players)\n * [get_trending_players()](#get_trending_players)\n3. [Notes](#notes)\n4. [Dependecnies](#depends)\n5. [License](#license)\n\n\n# Install\n~~~\npip install sleeper-api-wrapper\n~~~\n\n\n# Usage\nThere are five objects that get data from the Sleeper API specified below. Most of them are intuitive based on the Sleeper Api docs. \n\n\n\n## League\n\n\n### Initiaize\n~~~\nfrom sleeper_wrapper import League\n\nleague = League(league_id)\n~~~\n- league_id: (str)The id of your sleeper league\n\n\n### League.get_league()\nGets data for the league that was specified when the League object was initialized. Data returned looks like: https://docs.sleeper.app/#get-a-specific-league\n\n\n### League.get_rosters()\nGets all of the rosters in the league. Data returned looks like: https://docs.sleeper.app/#getting-rosters-in-a-league\n\n\n### League.get_users()\nGets all of the users in the league. Data returned looks like: https://docs.sleeper.app/#getting-users-in-a-league\n\n\n### League.get_matchups(week)\nGets all of the users in the league. Data returned looks like: https://docs.sleeper.app/#getting-matchups-in-a-league\n\n- week:(int or string) week of the matchups to be returned.\n\n\n### League.get_playoff_winners_bracket()\nGets the playoff winners bracket for the league. Data returned looks like: https://docs.sleeper.app/#getting-the-playoff-bracket\n\n\n### League.get_playoff_losers_bracket()\nGets the playoff losers bracket for the league. Data returned looks like: https://docs.sleeper.app/#getting-the-playoff-bracket\n\n\n### League.get_transactions(week)\nGets all of the transactions data in the league. Data returned looks like: https://docs.sleeper.app/#get-transactions\n\n- week:(int or str) week of the matchups to be returned.\n\n\n### League.get_traded_picks()\nGets all of the traded picks in the league. Data returned looks like: https://docs.sleeper.app/#get-traded-picks\n\n\n### League.get_all_drafts()\nGets all of the draft data in the league. Data returned looks like: https://docs.sleeper.app/#get-all-drafts-for-a-league\n\n\n### League.get_standings(rosters, users)\nGets the standings in a league. Returns a list of the standings in order of most wins to least wins.\n- rosters: (list)The data returned by the get_rosters() method.\n- users: (list)The data returned by the get_standings() method.\n\nData returned looks like:\n\n~~~\n[(username, number_of_wins, number_of_losses, total_points), (username, number_of_wins, number_of_losses, total_points),...]\n~~~\n- types: username(str), number_of_wins(int), number_of_losses(int), total_points(int)\n- \"username\" could be None if a user does not have a username.\n\nExample usage:\n\n~~~\n \tleague = League(league_id)\n\trosters = league.get_rosters()\n\tusers = league.get_users()\n\tstandings = league.get_standings(rosters,users)\n~~~\n\n\n### League.get_scoreboards(rosters, matchups, users, score_type, week)\nGets the scoreboards of the league. Returns a dict of league mathups and scores.\n- rosters: (list)The data returned by the get_rosters() method.\n- matchups: (list)The data returned by the get_mathcups() method.\n- users: (list)The data returned by the get_standings() method.\n- score_type: (string) either \"pts_std\", \"pts_half_ppr\", or \"pts_ppr\".\n- week: (int) week\n\nData returned looks like:\n\n~~~\n{matchup_id:[(team_name,score), (team_name, score)], matchup_id:[(team_name,score), (team_name, score)], ... }\n~~~\n- types: matchup_id(int), team_name(str), score(float)\n\nExample usage:\n\n~~~\n \tleague = League(league_id)\n\tmatchups = league.get_matchups(11)\n\tusers = league.get_users()\n\trosters = league.get_rosters()\n\tscoreboards = league.get_scoreboards(rosters, matchups, users)\n~~~\n\n### League.get_close_games(scoreboards, close_num)\nGets all of the close games in a league. Returns a dict.\n- scoreboards: (dict)The data returned by the get_scoreboards() method.\n- close_num: (int)How close the games need to be considered a close game. For example, if the close num is 5, the data returned would only include matchups that are within 5 points of each other.\n\nData returned looks like:\n\n~~~\n{matchup_id:[(team_name,score), (team_name, score)], matchup_id:[(team_name,score), (team_name, score)], ... }\n~~~\n- types: matchup_id(int), team_name(str), score(float)\n\nExample usage:\n\n~~~\n \tleague = League(league_id)\n\tmatchups = league.get_matchups(11)\n\tusers = league.get_users()\n\trosters = league.get_rosters()\n\tscoreboards = league.get_scoreboards(rosters, matchups, users)\n\tclose_games = league.get_close_games(scoreboards, 10)\n~~~\n\n## User\n\n\n### Initiaize\n~~~\nfrom sleeper_wrapper import User\n\nuser = User(user_id)\n~~~\n- user_id: (str)The id of a user. It can also be a username.\n\n\n### User.get_user()\nGets data for the user that was specified by the user_id or username when the User object was initialized. Data returned looks like: https://docs.sleeper.app/#user\n\n\n### User.get_all_leagues(sport, season)\nGets the data of all of the leagues that a user belongs to. Data returned looks like: https://docs.sleeper.app/#get-all-leagues-for-user\n\n- sport: (str)The sport of the leagues. Currently, it can ony be \"nfl\".\n- season: (int or str)The season of the leagues. ex. 2018,2019, etc.\n\n\n### User.get_all_drafts(sport, season)\nGets the data of all of the drafts of a user in the specified season. Data returned looks like: https://docs.sleeper.app/#get-all-drafts-for-user\n\n- sport: (str)The sport of the leagues. Currently, it can ony be \"nfl\".\n- season: (int or str)The season of the leagues. ex. 2018,2019, etc.\n\n\n### User.get_username()\nReturns the username of the User. This can be useful if the User was initialized with a user_id.\n\n\n### User.get_user_id()\nReturns the user_id of the User. This can be useful if the User was initialized with a username.\n\n\n## Stats\n\n\n### Initiaize\n~~~\nfrom sleeper_wrapper import Stats\n\nstats = Stats()\n~~~\n\n### Stats.get_all_stats(season_type, season)\nGets all of the stats in a season. Data returned looks like: https://docs.sleeper.app/#stats-and-projections\n\n- season_type: (str) The type of the season. Supports \"regular\", \"pre\", \"post\".\n- season: (int or str) The season of the leagues. ex. 2018,2019, etc.\n\n\n### Stats.get_week_stats(season_type, season, week)\nGets all of the stats for a specific week in a season. Data returned looks like: https://docs.sleeper.app/#stats-and-projections\n\n- season_type: (str) The type of the season. Supports \"regular\", \"pre\", \"post\".\n- season: (int or str) The season of the leagues. ex. 2018,2019, etc.\n- week: (int or str) The week of the stats to get.\n\n\n### Stats.get_all_projections(season_type, season)\nGets all of the projections in a season. Data returned looks like: https://docs.sleeper.app/#stats-and-projections\n\n- season_type: (str) The type of the season. Supports \"regular\", \"pre\", \"post\".\n- season: (int or str) The season of the leagues. ex. 2018,2019, etc.\n\n\n### Stats.get_week_projections(season_type, season, week)\nGets all of the projections for a specific week in a season. Data returned looks like: https://docs.sleeper.app/#stats-and-projections\n\n- season_type: (str) The type of the season. Supports \"regular\", \"pre\", \"post\".\n- season: (int or str) The season of the leagues. ex. 2018,2019, etc.\n- week: (int or str) The week of the stats to get.\n\n\n### Stats.get_player_week_score(week_stats, player_id)\nGets the player score of a specified week.\n\n- week_stats: (dict) The result of the method get_week_stats().\n- player_id: (str) The player_id of the player to get the stats of. ex. 2018,2019, etc.\n\nData returned looks like:\n~~~\n{'pts_ppr':score_float, 'pts_std': score_float, 'pts_half_ppr': score_float}\n~~~\n- types: score_float(float)\n- If the score is not available for a format, the value will be None.\n\nExample usage:\n\n~~~\n \tstats = Stats()\n\tweek_stats = stats.get_week_stats(\"regular\",2018, 5)\n\tscore = stats.get_player_week_score(week_stats, \"DET\")\n~~~\n\n## Players\n\n\n### Initiaize\n~~~\nfrom sleeper_wrapper import Players\n\nplayers = Players()\n~~~\n\n### Players.get_all_players()\nGets all of the players in fantasy football. Data returned looks like: https://docs.sleeper.app/#fetch-all-players\n\n\n### Players.get_trending_players(sport, add_drop, hours, limit)\nGets all of the players in fantasy football. Data returned looks like: https://docs.sleeper.app/#trending-players\n\n- sport: (str) The sport to get. Supports only \"nfl\" right now.\n- add_drop: (str) Either \"add\" or \"drop\".\n- hours: (int or str) Number of hours to look back. Default is 24 hours.\n- limit: (int or str) Number of results you want. Default is 25.\n\n\n# Notes\nThis package is intended to be used by Python version 3.5 and higher. There might be some wacky results for previous versions.\n\n\n# Dependancies\n\n[requests](https://github.com/kennethreitz/requests)\n- Used for all http requests in sleeper_wrapper\n\n[pytest](https://github.com/pytest-dev/pytest)\n- Used for all testing in sleeper_wrapper\n\n\n# License\nThis project is licensed under the terms of the MIT license.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SwapnikKatkoori/sleeper-api-wrapper", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sleeper-api-wrapper", "package_url": "https://pypi.org/project/sleeper-api-wrapper/", "platform": "", "project_url": "https://pypi.org/project/sleeper-api-wrapper/", "project_urls": { "Homepage": "https://github.com/SwapnikKatkoori/sleeper-api-wrapper" }, "release_url": "https://pypi.org/project/sleeper-api-wrapper/1.0.7/", "requires_dist": [ "requests (==2.22.0)", "pytest (==4.6.2)" ], "requires_python": "", "summary": "A Python API wrapper for Sleeper Fantasy Football, as well as tools to simplify data recieved.", "version": "1.0.7" }, "last_serial": 5806416, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "cb8d759fcbb85febca6a1af2553a25d1", "sha256": "5b3e47283b63693a360a57ef95b4e4a5e0a9617b2150daa27b7288b95ade6a44" }, "downloads": -1, "filename": "sleeper_api_wrapper-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "cb8d759fcbb85febca6a1af2553a25d1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8648, "upload_time": "2019-06-17T08:50:11", "url": "https://files.pythonhosted.org/packages/ea/52/b1c17e8a9079e34e32452d8ff1354ea874f9c276fa30c4177fdb316b3003/sleeper_api_wrapper-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d51aed2e1b4244d0084b66a057f99316", "sha256": "9b2e6d552fb9f61c7ee14b46067bc002df32073162db54aece918d7b5fbb0cfe" }, "downloads": -1, "filename": "sleeper-api-wrapper-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d51aed2e1b4244d0084b66a057f99316", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7507, "upload_time": "2019-06-17T08:50:13", "url": "https://files.pythonhosted.org/packages/ad/b9/2c0b7822c1ae42d89d6d38dd27d9fc0ce7bf847c08b053e51e3707f65645/sleeper-api-wrapper-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "d827c35ed361a98f14714d54fe2f23ec", "sha256": "05cb99ce2787dac329b8cb89ae5aed53f1b23e652f75a2b7693a045cdaeab197" }, "downloads": -1, "filename": "sleeper_api_wrapper-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d827c35ed361a98f14714d54fe2f23ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8649, "upload_time": "2019-06-17T08:55:04", "url": "https://files.pythonhosted.org/packages/3e/90/d974ee1bfe8f40b4178de11dc45667642a463d9380e26bdfabbbaa210cca/sleeper_api_wrapper-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "59e246fc6f31131808b40a1f9233d69e", "sha256": "fd076c8678fb2d82b73972032d2907fa6132d287d122c39db5b7aee06550aaf2" }, "downloads": -1, "filename": "sleeper-api-wrapper-1.0.2.tar.gz", "has_sig": false, "md5_digest": "59e246fc6f31131808b40a1f9233d69e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7502, "upload_time": "2019-06-17T08:55:06", "url": "https://files.pythonhosted.org/packages/c5/64/3fdbd0c233064ced73451e287f1bddd7ad7361a4e61c96fb1b44e523d616/sleeper-api-wrapper-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "71e3dcb74d0ff6d11bac86c7e204a213", "sha256": "f282b88e55c2d094ad4196d1392272b4b902a90bafdf067ae4545731ea5314d0" }, "downloads": -1, "filename": "sleeper_api_wrapper-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "71e3dcb74d0ff6d11bac86c7e204a213", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8675, "upload_time": "2019-08-14T22:27:59", "url": "https://files.pythonhosted.org/packages/9f/19/86deb00c258f67e1fae17f17bb6e7a7acd7df9ead958207492b6e765cc53/sleeper_api_wrapper-1.0.3-py3-none-any.whl" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "9e032100a700d688cb2af950d5c5700b", "sha256": "29f51abe69f9be24e003a20ccd4c258946ccc756a3f059e9ecf6b01e49ac6dd0" }, "downloads": -1, "filename": "sleeper_api_wrapper-1.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "9e032100a700d688cb2af950d5c5700b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8674, "upload_time": "2019-09-06T15:07:46", "url": "https://files.pythonhosted.org/packages/2a/5b/69be9a11b6946523a07f95c06aaa1e99b502993bf0a8e9329c5c89264df6/sleeper_api_wrapper-1.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "344f1b85452f1e53339f5e51da5d6877", "sha256": "edf04b53bf82ece879c4b76ace2d4c00613c15200564fc457b4f415dd4c8c0f3" }, "downloads": -1, "filename": "sleeper-api-wrapper-1.0.4.tar.gz", "has_sig": false, "md5_digest": "344f1b85452f1e53339f5e51da5d6877", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7515, "upload_time": "2019-09-06T15:07:47", "url": "https://files.pythonhosted.org/packages/80/27/337cad43be0b4949e8b7a678a8455464930c0fcb868a6bdf4a41b3275233/sleeper-api-wrapper-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "412263dfb5bb25dc1290edf262961050", "sha256": "ff2905a964c2d16a1d20d8521e4030696cbd29d440abe91afb2e9683f7f72598" }, "downloads": -1, "filename": "sleeper_api_wrapper-1.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "412263dfb5bb25dc1290edf262961050", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8850, "upload_time": "2019-09-06T15:15:22", "url": "https://files.pythonhosted.org/packages/af/03/a9b5beb25186cfd2f992c7dd6605fac6c204bae19f7a1c76fcbe73e1e079/sleeper_api_wrapper-1.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f052a34c9004bba6d5c3704cbb4f7563", "sha256": "2b7fca592cdf193457f827fc353eba0458d2c79e62a4b69aabf7d5940dd818cb" }, "downloads": -1, "filename": "sleeper-api-wrapper-1.0.5.tar.gz", "has_sig": false, "md5_digest": "f052a34c9004bba6d5c3704cbb4f7563", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7949, "upload_time": "2019-09-06T15:15:24", "url": "https://files.pythonhosted.org/packages/8a/38/699b2b91d839208ca948cebaaf61015195bd130d2d4076014afef8e23007/sleeper-api-wrapper-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "ed9899cc5b35b3e4d12698e594c5c271", "sha256": "7ae923b31556b7f2b19187eda67071d3759d519fa1b33bbb9b2f895cca198bc9" }, "downloads": -1, "filename": "sleeper_api_wrapper-1.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "ed9899cc5b35b3e4d12698e594c5c271", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8852, "upload_time": "2019-09-06T15:29:17", "url": "https://files.pythonhosted.org/packages/16/50/13a3d92b298a9f6a270a2fcde65a4f00be319217d8e64c8145b01efcd477/sleeper_api_wrapper-1.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "833d44f9bdb0eb04816e0f348438c50b", "sha256": "e5cc79a39446067d085377bcc8464470938a1233597d0caf340263dca5cd43c6" }, "downloads": -1, "filename": "sleeper-api-wrapper-1.0.6.tar.gz", "has_sig": false, "md5_digest": "833d44f9bdb0eb04816e0f348438c50b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7955, "upload_time": "2019-09-06T15:29:18", "url": "https://files.pythonhosted.org/packages/e8/03/211c22551d19beb54f80c0016c0cc457f50cfa7c5a9c86d8f37e924a8676/sleeper-api-wrapper-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "482e4b1e1552481fa160317dda1dc59f", "sha256": "8bb201ea5607b5402262172d49a9acc75972bdd8292494558e5039563fdcd60f" }, "downloads": -1, "filename": "sleeper_api_wrapper-1.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "482e4b1e1552481fa160317dda1dc59f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8879, "upload_time": "2019-09-10T01:56:37", "url": "https://files.pythonhosted.org/packages/21/8c/cac170ba2d3bcc2969b3f95bf06c5d480c44d4768498ad3954de72749517/sleeper_api_wrapper-1.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64486f7f6965746af13e9339dd99a954", "sha256": "d8b27d009c85ae1a0c5079ff290230b589c198e78f6c50e6c31e63ff552c55d5" }, "downloads": -1, "filename": "sleeper-api-wrapper-1.0.7.tar.gz", "has_sig": false, "md5_digest": "64486f7f6965746af13e9339dd99a954", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7988, "upload_time": "2019-09-10T01:56:38", "url": "https://files.pythonhosted.org/packages/b2/f8/91ff6fda50060687464b9b029743e60c128a217186f9fdf033ecab7740b0/sleeper-api-wrapper-1.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "482e4b1e1552481fa160317dda1dc59f", "sha256": "8bb201ea5607b5402262172d49a9acc75972bdd8292494558e5039563fdcd60f" }, "downloads": -1, "filename": "sleeper_api_wrapper-1.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "482e4b1e1552481fa160317dda1dc59f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8879, "upload_time": "2019-09-10T01:56:37", "url": "https://files.pythonhosted.org/packages/21/8c/cac170ba2d3bcc2969b3f95bf06c5d480c44d4768498ad3954de72749517/sleeper_api_wrapper-1.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64486f7f6965746af13e9339dd99a954", "sha256": "d8b27d009c85ae1a0c5079ff290230b589c198e78f6c50e6c31e63ff552c55d5" }, "downloads": -1, "filename": "sleeper-api-wrapper-1.0.7.tar.gz", "has_sig": false, "md5_digest": "64486f7f6965746af13e9339dd99a954", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7988, "upload_time": "2019-09-10T01:56:38", "url": "https://files.pythonhosted.org/packages/b2/f8/91ff6fda50060687464b9b029743e60c128a217186f9fdf033ecab7740b0/sleeper-api-wrapper-1.0.7.tar.gz" } ] }