Esempio n. 1
0
class MatchHistory(Api):
    url = "https://api.steampowered.com/IDOTA2Match_570/GetMatchHistory/V001/?"

    def __init__(self, key):
        super(MatchHistory, self).__init__(key)
        self.match_api = MatchDetails(key)

    def matches(self, **kwargs):
        """ Fetch match information.
        The available options are:
        player_name=<name>      # Search matches with a player name, exact match only
        hero_id=<id>            # Search for matches with a specific hero being played (hero ID, not name)
        skill=<skill>           # 0 for any, 1 for normal, 2 for high, 3 for very high skill (default is 0)
        date_min=<date>         # date in UTC seconds since Jan 1, 1970 (unix time format)
        date_max=<date>         # date in UTC seconds since Jan 1, 1970 (unix time format)
        account_id=<id>         # A user's 32-bit steam ID
        league_id=<id>          # matches for a particular league
        start_at_match_id=<id>      # Start the search at the indicated match id, descending
        matches_requested=<n>       # Maximum is 25 matches (default is 25)
        """
        result = self._get(**kwargs)
        for match in result['result']['matches']:
            try:
                yield self.match_api.match(match['match_id'])
            except ApiError:
                yield Match(self.match_api, **match)
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)])
Esempio n. 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)]

Esempio n. 4
0
 def __init__(self, key):
     super(MatchHistory, self).__init__(key)
     self.match_api = MatchDetails(key)
Esempio n. 5
0
 def __init__(self, key):
     super(MatchHistoryBySequenceNum, self).__init__(key)
     self.match_api = MatchDetails(key)