Client¶
The StartGGClient is the primary entry point for fetching data from the start.gg
GraphQL API. It handles authentication, rate limiting and exponential-backoff retries on transient
failures.
- class lptk.StartGGClient¶
Bases:
objectClient for the start.gg GraphQL API.
This client provides methods for fetching tournament data including event information, standings, phases, and match details.
- api_url¶
The GraphQL API endpoint URL.
- rate_limit_delay¶
Delay between API calls in seconds.
Example
>>> with StartGGClient() as client: ... event_id, name = client.get_event_id("tournament/xyz/event/abc") ... teams = client.get_event_standings(event_id, top_n=16)
- __init__(token=None, session=None)¶
Initialize the StartGG client.
- Parameters:
- Raises:
ConfigurationError – If token is not provided and not found in config.
- get_event_id(slug)¶
Get event ID and name from a slug.
- Parameters:
slug (
str) – Event URL slug (e.g., “tournament/xyz/event/abc”).- Return type:
- Returns:
Tuple of (event_id, event_name).
- Raises:
StartGGAPIError – If the event is not found or request fails.
- get_event_standings(event_id, top_n)¶
Get event-level standings (final placements).
- get_tournament_phases(event_id)¶
Get all phases for an event with metadata.
- Parameters:
event_id (
int) – Internal start.gg event ID.- Return type:
- Returns:
List of Phase models with phase groups.
- Raises:
StartGGAPIError – If the event is not found or request fails.
- get_phase_group_standings(phase_group_id)¶
Get standings from a specific phase group.
- get_phase_group_seeds(phase_group_id)¶
Get seeds from a phase group (for upcoming phases).
- get_set_details(set_id)¶
Get details of a specific match/set.
- Parameters:
set_id (
int) – Internal start.gg set ID.- Return type:
- Returns:
SetDetails model or None if not found/incomplete.
- get_entrant_last_elimination_set_id(event_id, entrant_id)¶
Get the ID of the set that eliminated an entrant.