summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-01-31 14:01:53 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-01-31 14:01:53 +0100
commitc1fb8e31aa791548254a2d6e8c37f4403d24fd7b (patch)
treeed66b20d21630f302cb23ba3b28a3a0b6d354a71
parent3a96203f89ebb87683d5e0151629f05ed0bb6373 (diff)
downloadpython-gamelocker-c1fb8e31aa791548254a2d6e8c37f4403d24fd7b.tar.gz
python-gamelocker-c1fb8e31aa791548254a2d6e8c37f4403d24fd7b.zip
add example: get kda in matches
-rw-r--r--examples/kda.py32
1 files changed, 32 insertions, 0 deletions
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)