From f3a988f588da40cd9a444dca49f5269803e12ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gl=C3=BCpker?= Date: Sat, 6 Jan 2018 21:18:51 +0100 Subject: Some code cleanup --- SteamAPI.py | 9 ++------- main.py | 4 ++-- templates/premades_html.jinja | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/SteamAPI.py b/SteamAPI.py index cc67f20..47efe1a 100644 --- a/SteamAPI.py +++ b/SteamAPI.py @@ -70,10 +70,9 @@ class SteamAPI(): for steamid in cachedids: steamids_copy.remove(steamid) - if len(steamids_copy): + if steamids_copy: steamidlist = ','.join([str(x) for x in steamids_copy]) - url = 'https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?format=json&key=%s&steamids=%s' % (self.token, steamidlist) - # print(url) + url = 'https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/?format=json&key=%s&steamids=%s' % (self.token, steamidlist) response = urlopen(url) if response.status != 200: print('Isn\'t this an HTTPError?') @@ -120,7 +119,6 @@ class SteamAPI(): return json.loads(cache) url = 'https://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key=%s&steamid=%s&relationship=friend' % (self.token, str(steamid)) - # print(url) try: response = urlopen(url) data = response.read().decode('utf-8') @@ -214,11 +212,8 @@ class SteamAPI(): if cache: jsondata = json.loads(cache) return jsondata - else: - print('nocache') url = 'http://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?key=%s&steamid=%s&appid=%s' % (self.token, str(steamid), str(gameid)) - print(url) try: response = urlopen(url) data = response.read().decode('utf-8') diff --git a/main.py b/main.py index 4071be0..c63f63d 100755 --- a/main.py +++ b/main.py @@ -112,9 +112,9 @@ def lobby(): ip, port = gameserver.split(':') port = int(port) gameid = playerdata['gameid'] - print('Query Server:', ip, port, gameid) + # print('Query Server:', ip, port, gameid) server = QueryServer.QueryServer(ip, port, gameid) - print('Response:', server) + # print('Response:', server) if server: serverinfo[gameserver] = server diff --git a/templates/premades_html.jinja b/templates/premades_html.jinja index 548a451..8fc4043 100644 --- a/templates/premades_html.jinja +++ b/templates/premades_html.jinja @@ -27,7 +27,7 @@ var graph = Viva.Graph.graph(); {% for steamid in steamids %} - graph.addNode('{{ steamid }}', {url : '{{ profiles[steamid]['avatarmedium'] }}', name : '{{ profiles[steamid]['personaname']|e }}', friends : {% if profiles[steamid]['communityvisibilitystate'] == 3 %} 'yes' {% else %} 'no' {% endif %}}); + graph.addNode('{{ steamid }}', {url: '{{ profiles[steamid]['avatarmedium'] }}', name: '{{ profiles[steamid]['personaname']|e }}', link: '{{ profiles[steamid]['profileurl'] }}', friends: {% if profiles[steamid]['communityvisibilitystate'] == 3 %} 'yes' {% else %} 'no' {% endif %}}); {% endfor %} {% for connection in connections %} graph.addLink('{{ connection[0] }}', '{{ connection[1] }}'); -- cgit v1.2.3