Coder Social home page Coder Social logo

dotamatch's Introduction

Dotamatch

Python bindings for the Dota 2 API.

Take a look in the examples for clues as to how to run it! This readme will slowly grow to become more friendly as things get more concrete.

If you need an account ID that's public, mine is 507891.

Some Design Comments

I've decided that Valve's names for APIs (GetTeamInfoByTeamId, for example) aren't very conducive to readable code, so I've taken a few liberties with my naming.

I intend to use python native data types whenever possible, and keep things quite close to generic dicts and lists where possible. For example, I'm going to convert Valve's dates and times to Python datetime objects.

I'm going to aim to lazy-load as much as possible in future, but for now, quite a lot is eager loaded. I suggest you keep an eye on the number of API calls that you're making! As it stands, the code is very simple, so it should be pretty easy to follow and get to grips with.

The Basics

You'll need a Steam API key to get started. You can get that here: http://steamcommunity.com/dev/apikey

So let's jump in:

key = "Insert your Steam API key here!"
history = MatchHistory(key)
for match in history.matches():
    print match

That is enough to get you some data. Not very useful, though, is it? Well, once we have a match, we can grab a player from it and inspect them:

player = match.player('Maccy')
if player:
    print player

So here, player is just a dictionary. You've pretty much got the JSON that Valve's API offers in python form. Right now, that is basically the limit of this API. You can attach the API's parameters to any API call though, so, say you wanted to get my 10 most recent games:

key = "Insert your Steam API key here!"
history = MatchHistory(key)
for match in history.matches(account_id=507891, matches_requested=10):
    print match.match_id

Supported APIs

  • GetMatchHistory
  • GetMatchDetails
  • GetHeroes
  • GetPlayerSummaries
  • EconomySchema
  • GetMatchHistoryBySequenceNum
  • GetTeamInfoByTeamId

Links

Build Status

dotamatch's People

Contributors

veryhappythings avatar vectorious avatar leth avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.