You can request player profile cards (containing stats like trophies, matches, or MMR) using dota.request_profile_card(account_id). There are two ways to handle the response:
1. Using the 'profile_card' event
This is the standard way. When the request completes, the profile_card event is emitted with the account_id and the profile_card data.
2. Using a Job ID
request_profile_card returns a job id. You can use dota.wait_msg(jobid, timeout=...) to block until the job completes.
Note: When waiting for a job ID, the returned argument is only the protobuf message, not the (account_id, profile_card) tuple provided by the event.
Note: Not all requests return a job ID; check the API documentation for specific method details.
# Method 1: Event-based
@dota.on('ready')
def fetch_profile_card():
dota.request_profile_card(70388657)
@dota.on('profile_card')
def print_profile_card(account_id, profile_card):
if account_id == 70388657:
print str(profile_card)
# Method 2: Job ID-based
@dota.on('ready')
def fetch_profile_card_job():
jobid = dota.request_profile_card(70388657)
profile_card = dota.wait_msg(jobid, timeout=10)
if profile_card:
print str(profile_card)