This part of the documentation is a quick start for writing applications that
interact with the game coordinator for Dota 2.

Working with events

This module makes use of gevent

and gevent-eventemitter
.
Working with events is similar to
in javascript.
Nevertheless, here is a quick rundown.

To catch an event we need to register a callback

  

 
 

 
   # call do_stuff just one time 

 
  

Emitting an event is simple

  

   # optional arguments 

  

Fetch player profile card

You’ve probably seen the profile cards in Dota 2.
They contain player selected stats, such trophies, number of matches, or MMR.

We can request that data using an API from the
module.

Let’s get Dendi’s profile card. All we need is his account id, which is
.

  

 
 


 
 
 
  

The profile card request also happens to be a job.

returns a
and we can wait for it instead.
However, we will not get the same parameters as from

Listening to the
will only give you one argument: the protobuf message

  

 
 
 

 
 
  

Not every request returns a
, see the API documentation for details

Running the code above will output something like this:

  
 
 
 
 
 
 
 
 

 
 
 
 
 
  

Configure console logging

Here is a basic configuration to get debug messages in the console.

  
 

   
 
  

The we run the program and the console ouput should look something like this: