summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2018-03-30 12:58:44 +0200
committerAndré Glüpker <git@wgmd.de>2018-03-30 12:59:42 +0200
commit2c07560dab55c4c8e6f9885451488f96c7fc2338 (patch)
treebfc01ebb048031c1e27bbeade3d4449b0d00bca5
parent53b1e14cc7287a971f48ba831568fd7c3910b059 (diff)
downloadsteam-2c07560dab55c4c8e6f9885451488f96c7fc2338.tar.gz
steam-2c07560dab55c4c8e6f9885451488f96c7fc2338.tar.bz2
steam-2c07560dab55c4c8e6f9885451488f96c7fc2338.zip
Support game update check in SteamAPI
-rw-r--r--SteamAPI.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/SteamAPI.py b/SteamAPI.py
index 1790989..e6548fc 100644
--- a/SteamAPI.py
+++ b/SteamAPI.py
@@ -269,6 +269,43 @@ class SteamAPI():
return jsondata
return None
+ def getGameUpdateState(self, gameid, gameversion):
+ """Fetch the current game update state.
+
+ Args:
+ gameid: Steam game id
+ gameversion: Current version of the game
+ Returns:
+ dict() with the following keys:
+ - success Boolean Was able to check version
+ - up_to_date Boolean If the game is up to date
+ - version_is_listable Boolean If the game version is listed
+ - required_version (int) ? New version ?
+ - message (String) Message to display
+ """
+
+ if CACHE:
+ cache = Caching.readCache('serverupdate', '%s-%s' % (str(gameid), str(gameversion)), 60*60)
+ if cache:
+ cachedata = json.loads(cache)
+ return cachedata
+
+ url = 'http://api.steampowered.com/ISteamApps/UpToDateCheck/v1?appId={0}&version={1}'.format(gameid, gameversion)
+ try:
+ response = urlopen(url)
+ data = response.read().decode('utf-8')
+ jsondata = json.loads(data)
+ if 'response' in jsondata:
+ jsondata = jsondata['response']
+ except HTTPError:
+ jsondata = None
+
+ if jsondata:
+ if CACHE:
+ cache = Caching.writeCache('serverupdate', '%s-%s' % (str(gameid), str(gameversion)), json.dumps(jsondata))
+ return jsondata
+ return None
+
def getMultipleUserOwnedGames(self, steamids):
executor = ThreadPoolExecutor(max_workers=10)
futures = dict()