Sfoglia il codice sorgente

Code cleanup on Steam API: Camel-casing templates and function names

David Leonard 10 anni fa
parent
commit
4b546f9648

+ 9 - 11
hackathon_starter/hackathon/scripts/SteamAPI.py

@@ -1,26 +1,24 @@
 import requests
 import json
 SteamUN = "Marorin"
-# steamID = SteamIDpulling(SteamUN)
+
 key = '231E98D442E52B87110816C3D5114A1D'
 
-def gamespulling(steamID,key):
-    # Returns the XML data from the Steam API based of one's Steam ID number and returns a dictionary of gameids and minutes played.
+def gamesPulling(steamID,key):
+    # Returns the JSON data from the Steam API based of one's Steam ID number and returns a dictionary of gameids and minutes played.
     steaminfo = {'key': key, 'steamid': steamID,'format':'JSON','include_appinfo':'1'}
-    r = requests.get('http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/',params=steaminfo)  
+    r = requests.get('http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/', params=steaminfo)  
     d = json.loads(r.content)
-    # print d['response']['games']
-    # print r.json()
     return d['response']['games']
  
-def steamIDpulling(SteamUN,key):
+def steamIDPulling(SteamUN,key):
     #Pulls out and returns the steam id number for use in steam queries.
     steaminfo = {'key': key,'vanityurl': SteamUN}
-    a = requests.get('http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/',params=steaminfo)
+    a = requests.get('http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/', params=steaminfo)
     k = json.loads(a.content)
     SteamID = k['response']['steamid']
-    print SteamID
+    
     return SteamID
 # steampulling(steamID)
-steamID = steamIDpulling(SteamUN, key)
-gamespulling(steamID,key)
+steamID = steamIDPulling(SteamUN, key)
+gamesPulling(steamID,key)

hackathon_starter/hackathon/templates/hackathon/SteamAPI.html → hackathon_starter/hackathon/templates/hackathon/steam.html