from dotamatch import get_key
from dotamatch.history import MatchHistory
from dotamatch.matches import MatchDetails
from dotamatch.players import PlayerSummaries
from dotamatch.heroes import Heroes

key = get_key()
history = MatchHistory(key)
player_summaries = PlayerSummaries(key)
details = MatchDetails(key)
heroes = Heroes(key)

tidehunter_id = 29

for match in history.matches(skill=3, hero_id=tidehunter_id):
    match = details.match(match.match_id)
    for player in [p for p in match.players if p["hero_id"] == tidehunter_id]:
        for i in range(6):
            print("item_{0}".format(i), player["item_{0}".format(i)])
"""
This example fetches the player IDs from all the matches that an individual
player has played in.
"""
from dotamatch import get_key
from dotamatch.history import MatchHistory

key = get_key()
history = MatchHistory(key)

players = set()
for match in history.matches(account_id=507891):
    for player in match.players:
        players.add(player['account_id'])

print(players)
예제 #3
0
from dotamatch import get_key
from dotamatch.history import MatchHistory
from dotamatch.matches import MatchDetails
from dotamatch.players import PlayerSummaries
from dotamatch.heroes import Heroes

key = get_key()
history = MatchHistory(key)
player_summaries = PlayerSummaries(key)
details = MatchDetails(key)
heroes = Heroes(key)

tidehunter_id = 29

for match in history.matches(skill=3, hero_id=tidehunter_id):
    match = details.match(match.match_id)
    for player in [p for p in match.players if p['hero_id'] == tidehunter_id]:
        for i in range(6):
            print 'item_{0}'.format(i), player['item_{0}'.format(i)]

예제 #4
0
"""
This example fetches the last 10 matches of the specified vanity URL player, and prints which items that player
bought.
"""

from dotamatch import get_key
from dotamatch.players import ResolveVanityUrl, id_to_32
from dotamatch.history import MatchHistory, MatchDetails
import pprint

key = get_key()
history = MatchHistory(key)
match_details = MatchDetails(key)
id = ResolveVanityUrl(key).id('wek')
id_32 = id_to_32(id)

items = {}
for match in history.matches(account_id=id, matches_requested=10):
    details = match_details.match(match.match_id)
    player = details.player(id_32)
    for i in range(6):
        item_slot = 'item_' + str(i)
        try:
            items[player[item_slot]] += 1
        except KeyError:
            items[player[item_slot]] = 1

pprint.pprint(items)