Skip to content

Commit

Permalink
added another function
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyagreco committed Aug 30, 2024
1 parent d942b13 commit 742d6d8
Show file tree
Hide file tree
Showing 4 changed files with 625 additions and 2 deletions.
17 changes: 17 additions & 0 deletions sleeper/api/draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
DRAFT_ROUTE,
DRAFTS_ROUTE,
LEAGUE_ROUTE,
PICKS_ROUTE,
SLEEPER_APP_BASE_URL,
USER_ROUTE,
VERSION,
Expand Down Expand Up @@ -48,3 +49,19 @@ def get_draft(*, draft_id: str) -> dict:
if response_dict is None:
raise ValueError(f"Could not get Draft with draft_id '{draft_id}'.")
return response_dict


def get_player_draft_picks(*, draft_id: str, sport: Sport) -> list[dict]:
url = build_route(
SLEEPER_APP_BASE_URL,
VERSION,
DRAFT_ROUTE,
draft_id,
PICKS_ROUTE,
)
response_list = get(url)
if response_list is None:
raise ValueError(
f"Could not get PlayerDraftPicks with draft_id '{draft_id}' and sport '{sport.name}'."
)
return response_list
Loading

0 comments on commit 742d6d8

Please sign in to comment.