From c1fb8e31aa791548254a2d6e8c37f4403d24fd7b Mon Sep 17 00:00:00 2001 From: schneefux Date: Tue, 31 Jan 2017 14:01:53 +0100 Subject: add example: get kda in matches --- examples/kda.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/kda.py (limited to 'examples/kda.py') diff --git a/examples/kda.py b/examples/kda.py new file mode 100644 index 0000000..1727bf5 --- /dev/null +++ b/examples/kda.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Sat Jan 28 16:12:02 2017 + +@author: phypoh + +https://github.com/schneefux/python-gamelocker +""" +import gamelocker +from gamelocker.strings import pretty + +APIKEY = "aaa.bbb.ccc" +api = gamelocker.Gamelocker(APIKEY).Vainglory() + +#player_name = input("Player name?") + +player_name = "IraqiZorro" + +matches = api.matches({"page[limit]": 10, "filter[playerNames]": player_name}) + +match = matches[0] + +for team in range(2): + print("\nTeam", team+1) + for player in range(3): + name = match.rosters[team].participants[player].player.name + hero = pretty(match.rosters[team].participants[player].actor) + kills = match.rosters[team].participants[player].stats["kills"] + deaths = match.rosters[team].participants[player].stats["deaths"] + assists = match.rosters[team].participants[player].stats["assists"] + print(name, hero, kills, '/', deaths, '/', assists) -- cgit v1.3.1