GitXplorerGitXplorer
b

dota2.py

public
14 stars
4 forks
0 issues

Commits

List of commits on branch master.
Unverified
9704984f703aa8a8d1d75af393f78dfba88d1841

Merge pull request #3 from king110/master

bbryanveloso committed 9 years ago
Unverified
67e1a9d092eb36a02123d365ada77b51d7b4e305

Typo in readme example fixed

committed 10 years ago
Unverified
ecf757bec031809be673db9b585dc6238d265882

Merge pull request #2 from marksteve/master

committed 11 years ago
Unverified
af4eb304ec8d44448b167fa935cba1d9c9afdff8

Add Hero class and make get_heroes yield instances of it

mmarksteve committed 11 years ago
Unverified
ffdf30cedc7434f3872d4ce6c9dbc2fa184ab4f3

Set default language when getting heroes

mmarksteve committed 11 years ago
Unverified
15468173090859f343d3e15399ca8315fd6e4416

Variable rename

mmarksteve committed 11 years ago

README

The README file for this repository.

dota2.py

A minimalistic (but aiming to be comprehensive) library used to interact with Dota 2's (Defense of the Ancients) WebAPI.

Usage

First off, you'll need a Steam account. Once you have that you can sign up for an API key. Make sure to keep this key safe (e.g., not committing it to a public repository) as Valve is pretty strict about API access and rate limiting. We'd reccomend throwing it in an environment variable.

Here's how you use it:

>>> from dota2 import Dota2API
>>> api = Dota2API(api_key='<your-api-key>')
>>> api.get_steam_id('avalonstar')
u'76561198009545200'

Installation

It's easy and foolproof! You don't even have to worry about feeding!

pip install dota2

API

Dota2API.get_steam_id(vanity_name, **params)

Gets Steam id by vanity name (e.g. http://steamcommunity.com/id/vanity_name)

Arguments

  • vanity_name (str)

Dota2API.get_player_summaries(steam_ids, **params)

Gets player summaries given Steam ids

Arguments

  • steam_ids (str or iterable)

Dota2API.get_heroes(**params)

Gets available heroes list

Dota2API.get_match_history(player_name=None, hero_id=None, game_mode=None,skill=0, date_min=None, date_max=None, min_players=None, account_id=None, league_id=None, start_at_match_id=None, matches_requested=25, tournament_games_only=None, **params)

Gets list of match history

Arguments

  • player_name (str)
  • hero_id (int or str) (check dota2.HEROES)
  • game_mode (int) (check dota2.MATCH_GAME_MODES)
  • skill (int) (check dota2.MATCH_SKILL_LEVELS)
  • date_min (datetime.datetime or int)
  • date_max (datetime.datetime or int)
  • min_players (int)
  • account_id (int)
  • league_id (int)
  • start_at_match_id (int)
  • matches_requested (int)
  • tournament_games_only (int)

Dota2API.get_match_details(match_id, **params)

Gets details of a match given its id

Arguments

  • match_id (int)

Dota2API.get_league_listing(**params)

Gets list of leagues

Dota2API.get_live_league_games(**params)

Gets list of live league games