Skip to content

Commit

Permalink
more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyagreco committed Sep 12, 2024
1 parent bd96e8a commit 9ef333e
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions example/draft_example.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
from sleeper.api import DraftAPIClient
from sleeper.api.draft import (
get_draft,
get_drafts_in_league,
get_player_draft_picks,
get_traded_draft_picks,
get_user_drafts_for_year,
)
from sleeper.enum import Sport
from sleeper.model import Draft, DraftPick, PlayerDraftPick

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_drafts = get_user_drafts_for_year(
user_id="my_user_id", sport=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"
)
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
)
draft_picks = get_player_draft_picks(draft_id="my_draft_id", sport=Sport.NFL)

# get all traded draft picks for a particular draft
traded_draft_picks: list[DraftPick] = DraftAPIClient.get_traded_draft_picks(
draft_id="my_draft_id"
)
traded_draft_picks = get_traded_draft_picks(draft_id="my_draft_id")

0 comments on commit 9ef333e

Please sign in to comment.