feat(matches): 增加 matches file,获取比赛详情
增加 matches file,获取比赛详情 Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
parent
8303e7fa94
commit
4b31d228c6
23
matches.py
Normal file
23
matches.py
Normal file
@ -0,0 +1,23 @@
|
||||
import opendota
|
||||
|
||||
match_client = opendota.MatchesApi()
|
||||
|
||||
def serialize_player(player):
|
||||
player_data = {
|
||||
'personaname': player.personaname,
|
||||
'kills': player.kills,
|
||||
'deaths': player.deaths,
|
||||
'assists': player.assists,
|
||||
'total_gold': player.total_gold,
|
||||
'last_hits': player.last_hits,
|
||||
'denies': player.denies,
|
||||
}
|
||||
return player_data
|
||||
|
||||
def serialize_match(match_id):
|
||||
match = match_client.get_matches_by_match_id(match_id)
|
||||
match_data = {
|
||||
'players': [serialize_player(player) for player in match.players],
|
||||
}
|
||||
return match_data
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user