24 lines
557 B
Python
24 lines
557 B
Python
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
|
|
|