Endpoints

class d2api.APIWrapper(api_key=None, parse_response=True, requests_per_second=1)[source]

Wrapper initialization requires either environment variable D2_API_KEY be set, or api_key be provided as an argument.

Parameters:
  • api_key (str) – Steam API key
  • parse_response (bool) – set to False to get an unparsed json string
  • requests_per_second (int) – rate limit requests to send requests politely (set to -1 to ignore rate limiting)
get_broadcaster_info(**kwargs)[source]

Get the broadcasting status of a user.

Parameters:
  • account_id (int) – 32/64-bit account ID
  • steam_account (SteamAccount) – Used in place of account_id
Returns:

Broadcasting information of a user.

Return type:

BroadcasterInfo

get_game_items(**kwargs)[source]

Get a list of items in Dota 2.

Parameters:language (string, optional) – The language to provide hero names in
Returns:Item information.
Return type:GameItems
get_heroes(**kwargs)[source]

Get a list of heroes in Dota 2.

Parameters:
  • language (string, optional) –

    The language to provide hero names in

  • itemizedonly (bool, optional) – Return a list of itemized heroes only
Returns:

Hero information.

Return type:

Heroes

get_live_league_games(**kwargs)[source]

Get a list of in-progress league matches, as well as their details at the time of query.

Returns:Details of in-progress live league games.
Return type:LiveLeagueGames
get_match_details(match_id, **kwargs)[source]

Get detailed information about a particular match.

Parameters:match_id (int, string) – Match ID
Returns:Details of a match.
Return type:MatchDetails
get_match_history(**kwargs)[source]

Get a list of matches, filtered by various parameters.

Parameters:
  • hero_id (int, optional) – Matches containing this hero. A list of hero IDs can be fetched via the get_heroes() method
  • hero (Hero, optional) – Used in place of hero_id
  • game_mode (int, optional) – Games of this game mode are fetched
  • skill (int, optional) – Skill bracket for the matches (Ignored if an account ID is specified)
  • min_players (int, optional) – Minimum amount of players in a match for the match to be returned.
  • account_id (int, optional) – 32/64-bit account ID
  • steam_account (SteamAccount, optional) – Used in place of account_id
  • league_id (int, optional) – Only return matches from this league. get_league_listing() has been discontinued
  • start_at_match_id (int, optional) – Start searching for matches equal to or older than this match ID
  • matches_requested (int, optional) – Defaults to 100
  • tournament_games_only (int, optional) – 0 = False, 1 = True
Returns:

Information of matches.

Return type:

MatchHistory

get_match_history_by_sequence_num(**kwargs)[source]

Get a list of matches ordered by sequence number. Uses a parser similar to that of get_match_history() method

Parameters:
  • start_at_match_seq_num (int) – The match sequence number to start returning results from
  • matches_requested (int, optional) – Defaults to 100
Returns:

Information of matches.

Return type:

MatchHistory

get_player_summaries(**kwargs)[source]

Get Steam details of users.

Parameters:
  • account_ids (list(int)) – 32/64-bit account ID
  • steam_accounts (list(SteamAccount)) – Used in place of account IDs
Returns:

Information of steam accounts

Return type:

PlayerSummaries

get_team_info_by_team_id(**kwargs)[source]

Get a list of teams’ information.

Parameters:
  • start_at_team_id (int, optional) – The team id to start returning results from
  • teams_requested (int, optional) – The amount of teams to return
Returns:

A list of teams’ information.

Return type:

TeamInfoByTeamID

get_top_live_game(partner=0, **kwargs)[source]

Get details of on-going live games.

Parameters:partner (int, optional) – Which partner’s games to use (default 0)
Returns:Details of on-going live games.
Return type:TopLiveGame
get_tournament_prize_pool(**kwargs)[source]

Get the current prizepool of specific tournaments.

Parameters:leagueid (int) – The ID of the league to get the prize pool of
Returns:Prizepool of a tournament.
Return type:TournamentPrizePool
d2api.update_local_data(purge=True)[source]

Synchronize local data with current repository data

Parameters:purge (bool) – Set to True to delete local content