为Sleeper Fantasy Football提供的PythonAPI包装,以及简化接收数据的工具。

sleeper-api-wrapper的Python项目详细描述


Build StatusGitHubGitHub issuesPyPI

轨枕api包装

为Sleeper Fantasy Football提供的PythonAPI包装,以及简化接收数据的工具它使sleeper api文档中的所有端点都可用,https://docs.sleeper.app/,并将接收到的json响应转换为python类型,以便于使用。

目录

  1. Installation

  2. Usage

  3. Notes

  4. Dependecnies

  5. License

Install

^{pr 1}$

Usage

There are five objects that get data from the Sleeper API specified below. Most of them are intuitive based on the Sleeper Api docs.

League

Initiaize

^{pr 2}$
  • league_id: (str)The id of your sleeper league

League.get_league()

Gets 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

League.get_rosters()

Gets all of the rosters in the league. Data returned looks like: https://docs.sleeper.app/#getting-rosters-in-a-league

League.get_users()

Gets all of the users in the league. Data returned looks like: https://docs.sleeper.app/#getting-users-in-a-league

League.get_matchups(week)

Gets all of the users in the league. Data returned looks like: https://docs.sleeper.app/#getting-matchups-in-a-league

  • 周:(int或string)要返回的匹配周。

League.get_playoff_winners_bracket()

Gets the playoff winners bracket for the league. Data returned looks like: https://docs.sleeper.app/#getting-the-playoff-bracket

League.get_playoff_losers_bracket()

Gets the playoff losers bracket for the league. Data returned looks like: https://docs.sleeper.app/#getting-the-playoff-bracket

League.get_transactions(week)

Gets all of the transactions data in the league. Data returned looks like: https://docs.sleeper.app/#get-transactions

  • 周:(int或str)要返回的匹配周

League.get_traded_picks()

Gets all of the traded picks in the league. Data returned looks like: https://docs.sleeper.app/#get-traded-picks

League.get_all_drafts()

Gets all of the draft data in the league. Data returned looks like: https://docs.sleeper.app/#get-all-drafts-for-a-league

League.get_standings(rosters, users)

Gets the standings in a league. Returns a list of the standings in order of most wins to least wins.

Data returned looks like:

^{pr 3}$
  • types: username(str), number_of_wins(int), number_of_losses(int), total_points(int)
  • "username" could be None if a user does not have a username.

Example usage:

^{pr 4}$

League.get_scoreboards(rosters, matchups, users)

Gets the scoreboards of the league. Returns a dict of league mathups and scores.

Data returned looks like:

^{pr 5}$
  • types: matchup_id(int), team_name(str), score(float)

Example usage:

^{pr 6}$

League.get_close_games(scoreboards, close_num)

Gets all of the close games in a league. Returns a dict.

Data returned looks like:

^{pr 5}$
  • types: matchup_id(int), team_name(str), score(float)

Example usage:

^{pr 8}$

User

Initiaize

^{pr 9}$
  • user_id: (str)The id of a user. It can also be a username.

User.get_user()

Gets 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

User.get_all_leagues(sport, season)

Gets 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

  • 体育:(str)联赛的体育运动。目前,它可以是“NFL”。
  • 赛季:(内景或外景)联赛的赛季例如20182019等

User.get_all_drafts(sport, season)

Gets 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

  • 体育:(str)联赛的体育运动。目前,它可以是“NFL”。
  • 赛季:(内景或外景)联赛的赛季例如20182019等

User.get_username()

Returns the username of the User. This can be useful if the User was initialized with a user_id.

User.get_user_id()

Returns the user_id of the User. This can be useful if the User was initialized with a username.

Stats

Initiaize

^{pr 10}$

Stats.get_all_stats(season_type, season)

Gets all of the stats in a season. Data returned looks like: https://docs.sleeper.app/#stats-and-projections

  • 季节类型:(str)季节的类型支持“常规”、“前置”、“后置”。
  • 赛季:(内景或外景)联赛的赛季。例如20182019等

Stats.get_week_stats(season_type, season, week)

Gets all of the stats for a specific week in a season. Data returned looks like: https://docs.sleeper.app/#stats-and-projections

  • 季节类型:(str)季节的类型支持“常规”、“前置”、“后置”。
  • 赛季:(内景或外景)联赛的赛季。例如20182019等
  • 周:(int或str)要获取的统计数据的周

Stats.get_all_projections(season_type, season)

Gets all of the projections in a season. Data returned looks like: https://docs.sleeper.app/#stats-and-projections

  • 季节类型:(str)季节的类型。支持“常规”、“前置”、“后置”。
  • 赛季:(内景或外景)联赛的赛季例如20182019等

Stats.get_week_projections(season_type, season, week)

Gets all of the projections for a specific week in a season. Data returned looks like: https://docs.sleeper.app/#stats-and-projections

  • 季节类型:(str)季节的类型。支持“常规”、“前置”、“后置”。
  • 赛季:(内景或外景)联赛的赛季。例如20182019等
  • 周:(int或str)要获取的统计数据的周。

Stats.get_player_week_score(week_stats, player_id)

Gets the player score of a specified week.

Data returned looks like:

^{pr 11}$
  • types: score_float(float)
  • If the score is not available for a format, the value will be None.

Example usage:

^{pr 12}$

Players

Initiaize

^{pr 13}$

Players.get_all_players()

Gets all of the players in fantasy football. Data returned looks like: https://docs.sleeper.app/#fetch-all-players

Players.get_trending_players(sport, add_drop, hours, limit)

Gets all of the players in fantasy football. Data returned looks like: https://docs.sleeper.app/#trending-players

  • 运动:(str)要得到的运动。现在只支持“NFL”。
  • add_drop:(str)“添加”或“删除”。
  • 小时:(int或str)要回顾的小时数。默认值为24小时。
  • limit:(int或str)所需的结果数。默认值为25

Notes

This package is intended to be used by Python version 3.5 and higher. There might be some wacky results for previous versions.

Dependancies

requests

  • 用于sleeper_wrapper中的所有http请求

pytest

  • 用于枕木包装的所有测试

许可证

这个项目是根据麻省理工学院的许可条款授权的。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android改造响应不等于邮递员响应   bean的spring初始化失败;嵌套的例外是java。lang.IllegalArgumentException:Pointcut格式不正确:应为“')”   java在运行时传递可选的未知参数   java Android:无法使用密码保护条目   java无法从SimpleIntegerProperty转换为属性<Integer>   java Ibatis:有没有办法在sqlmap xml中的Ibatis resultmap子选择中添加行处理程序?   java如何使用ant脚本运行maven项目?   java如何在DesignGridLayout库中动态创建JButton值?   java JPA多事务管理器   java Eclipse RCP,为编辑器添加了一个新视图   从源文件夹导入时,不会显示Java图像   使用hadoop2设置java单节点集群。4.0与cygwin   java如何连接图像?   JavaJPQL:向数据库中已经存在的值添加一个int值