-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51ed448
commit d1da81c
Showing
130 changed files
with
2,970 additions
and
6,273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10.14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
include sleeper/app.properties | ||
include requirements.txt | ||
include requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
PYTEST_ARGS= | ||
|
||
.PHONY: deps | ||
deps: | ||
@python3 -m pip install -r requirements.dev.txt | ||
@python3 -m pip install -r requirements.txt | ||
@python -m pip install -r requirements.dev.txt | ||
@python -m pip install -r requirements.txt | ||
|
||
.PHONY: fmt | ||
fmt: | ||
@black --config=pyproject.toml . | ||
@autoflake --config=pyproject.toml . | ||
@isort . | ||
@ruff check --fix | ||
@ruff format | ||
|
||
.PHONY: fmt-check | ||
fmt-check: | ||
@black --config=pyproject.toml --check . | ||
@autoflake --config=pyproject.toml --check . | ||
@isort --check-only . | ||
@ruff check | ||
@ruff format --check | ||
|
||
.PHONY: test-all | ||
test-all: | ||
@make test-unit $(PYTEST_ARGS) | ||
@make test-integration $(PYTEST_ARGS) | ||
|
||
.PHONY: test | ||
test: | ||
@pytest test/ | ||
.PHONY: test-unit | ||
test-unit: | ||
@pytest test/unit $(PYTEST_ARGS) | ||
|
||
.PHONY: up-reqs | ||
up-reqs: | ||
@pipreqs --force --mode no-pin | ||
.PHONY: test-integration | ||
test-integration: | ||
@pytest test/integration $(PYTEST_ARGS) | ||
|
||
.PHONY: pkg-build | ||
pkg-build: | ||
@rm -rf build | ||
@rm -rf dist | ||
@python3 setup.py sdist bdist_wheel | ||
@python setup.py sdist bdist_wheel | ||
|
||
.PHONY: pkg-test | ||
pkg-test: | ||
@python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* | ||
pkg-test: pkg-build | ||
@python -m twine upload --repository testpypi dist/* | ||
|
||
.PHONY: pkg-prod | ||
pkg-prod: | ||
@python3 -m twine upload dist/* | ||
pkg-prod: pkg-build | ||
@python -m twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
from sleeper.api import AvatarAPIClient | ||
from sleeper.api import get_avatar | ||
|
||
if __name__ == "__main__": | ||
# get avatar by ID and save locally | ||
AvatarAPIClient.get_avatar( | ||
avatar_id="my_avatar_id", save_to_path="C:\\Desktop\\avatar\\my_avatar.png" | ||
) | ||
# get avatar by ID | ||
avatar_bytes = get_avatar(avatar_id="my_avatar_id") | ||
|
||
# save locally | ||
with open( | ||
"my_avatar.png", | ||
"wb", | ||
) as file: | ||
file.write(avatar_bytes) | ||
|
||
# can pass in the "thumbnail" parameter to get a smaller-sized avatar | ||
AvatarAPIClient.get_avatar( | ||
avatar_id="my_avatar_id", save_to_path="C:\\Desktop\\avatar\\my_avatar.png", thumbnail=True | ||
get_avatar( | ||
avatar_id="my_avatar_id", | ||
as_thumbnail=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
from sleeper.api import DraftAPIClient | ||
from sleeper.enum import Sport | ||
from sleeper.model import Draft, DraftPick, PlayerDraftPick | ||
from sleeper.api import ( | ||
get_draft, | ||
get_drafts_in_league, | ||
get_player_draft_picks, | ||
get_traded_draft_picks, | ||
get_user_drafts_for_year, | ||
) | ||
|
||
if __name__ == "__main__": | ||
# get all drafts that a user was in for a particular year | ||
user_drafts: list[Draft] = DraftAPIClient.get_user_drafts_for_year( | ||
user_id="my_user_id", sport=Sport.NFL, year="2020" | ||
) | ||
# get all drafts that a user was in for a year | ||
user_drafts = get_user_drafts_for_year(user_id="my_user_id", sport="nfl", year=2020) | ||
|
||
# get all drafts for a particular league | ||
league_drafts: list[Draft] = DraftAPIClient.get_drafts_in_league(league_id="my_league_id") | ||
# get all drafts for a league | ||
league_drafts = get_drafts_in_league(league_id="my_league_id") | ||
|
||
# get a draft by its ID | ||
draft: Draft = DraftAPIClient.get_draft(draft_id="my_draft_id") | ||
draft = get_draft(draft_id="my_draft_id") | ||
|
||
# get all draft picks for a particular draft | ||
draft_picks: list[PlayerDraftPick] = DraftAPIClient.get_player_draft_picks( | ||
draft_id="my_draft_id", sport=Sport.NFL | ||
# get all draft picks for a draft | ||
draft_picks = get_player_draft_picks( | ||
draft_id="my_draft_id", | ||
) | ||
|
||
# get all traded draft picks for a particular draft | ||
traded_draft_picks: list[DraftPick] = DraftAPIClient.get_traded_draft_picks( | ||
draft_id="my_draft_id" | ||
) | ||
# get all traded draft picks for a draft | ||
traded_draft_picks = get_traded_draft_picks(draft_id="my_draft_id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,45 @@ | ||
from sleeper.api import LeagueAPIClient | ||
from sleeper.enum import Sport | ||
from sleeper.model import ( | ||
League, | ||
Matchup, | ||
PlayoffMatchup, | ||
Roster, | ||
SportState, | ||
TradedPick, | ||
Transaction, | ||
User, | ||
from sleeper.api import ( | ||
get_league, | ||
get_losers_bracket, | ||
get_matchups_for_week, | ||
get_rosters, | ||
get_sport_state, | ||
get_traded_picks, | ||
get_transactions, | ||
get_user_leagues_for_year, | ||
get_users_in_league, | ||
get_winners_bracket, | ||
) | ||
|
||
if __name__ == "__main__": | ||
# get a league by its ID | ||
league: League = LeagueAPIClient.get_league(league_id="my_league_id") | ||
league = get_league(league_id="my_league_id") | ||
|
||
# get all leagues for a user by its ID in a particular year | ||
user_leagues: list[League] = LeagueAPIClient.get_user_leagues_for_year( | ||
user_id="my_user_id", sport=Sport.NFL, year="2020" | ||
# get all leagues for a user by its ID in a year | ||
user_leagues = get_user_leagues_for_year( | ||
user_id="my_user_id", sport="nfl", year=2023 | ||
) | ||
|
||
# get all rosters in a particular league | ||
league_rosters: list[Roster] = LeagueAPIClient.get_rosters(league_id="my_league_id") | ||
# get all rosters in a league | ||
league_rosters = get_rosters(league_id="my_league_id") | ||
|
||
# get all users in a particular league | ||
league_users: list[User] = LeagueAPIClient.get_users_in_league(league_id="my_league_id") | ||
# get all users in a league | ||
league_users = get_users_in_league(league_id="my_league_id") | ||
|
||
# get all matchups in a week for a particular league | ||
week_1_matchups: list[Matchup] = LeagueAPIClient.get_matchups_for_week( | ||
league_id="my_league_id", week=1 | ||
) | ||
# get all matchups in a week for a league | ||
week_1_matchups = get_matchups_for_week(league_id="my_league_id", week=1) | ||
|
||
# get the winners bracket for a particular league | ||
winners_bracket: list[PlayoffMatchup] = LeagueAPIClient.get_winners_bracket( | ||
league_id="my_league_id" | ||
) | ||
# get the winners bracket for a league | ||
winners_bracket = get_winners_bracket(league_id="my_league_id") | ||
|
||
# get the losers bracket for a particular league | ||
losers_bracket: list[PlayoffMatchup] = LeagueAPIClient.get_losers_bracket( | ||
league_id="my_league_id" | ||
) | ||
# get the losers bracket for a league | ||
losers_bracket = get_losers_bracket(league_id="my_league_id") | ||
|
||
# get all transactions in a week for a particular league | ||
week_1_transactions: list[Transaction] = LeagueAPIClient.get_transactions( | ||
league_id="my_league_id", week=1 | ||
) | ||
# get all transactions in a week for a league | ||
week_1_transactions = get_transactions(league_id="my_league_id", week=1) | ||
|
||
# get all traded picks for a particular league | ||
traded_picks: list[TradedPick] = LeagueAPIClient.get_traded_picks(league_id="my_league_id") | ||
# get all traded picks for a league | ||
traded_picks = get_traded_picks(league_id="my_league_id") | ||
|
||
# get the state of a particular sport | ||
nfl_state: SportState = LeagueAPIClient.get_sport_state(sport=Sport.NFL) | ||
# get the state of a sport | ||
nfl_state = get_sport_state(sport="nfl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
from sleeper.api import PlayerAPIClient | ||
from sleeper.enum import Sport, TrendType | ||
from sleeper.model import Player, PlayerTrend | ||
from sleeper.api import get_all_players, get_trending_players | ||
|
||
if __name__ == "__main__": | ||
# get all players in a particular sport | ||
nfl_players: dict[str, Player] = PlayerAPIClient.get_all_players(sport=Sport.NFL) | ||
# get all players in a sport | ||
nfl_players = get_all_players(sport="nfl") | ||
|
||
# get all trending players that were added for a particular sport | ||
nfl_added_trending_players: list[PlayerTrend] = PlayerAPIClient.get_trending_players( | ||
sport=Sport.NFL, trend_type=TrendType.ADD | ||
) | ||
# get players that are trending up in a sport | ||
nfl_trending_up_players = get_trending_players(sport="nfl", trend_type="add") | ||
|
||
# get all trending players that were dropped for a particular sport | ||
nfl_dropped_trending_players: list[PlayerTrend] = PlayerAPIClient.get_trending_players( | ||
sport=Sport.NFL, trend_type=TrendType.DROP | ||
) | ||
# get players that are trending down in a sport | ||
nfl_trending_down_players = get_trending_players(sport="nfl", trend_type="drop") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.