[game-data-packager] 01/02: steam: do no throw exception when working offline
Alexandre Detiste
detiste-guest at moszumanska.debian.org
Tue Feb 16 18:32:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
detiste-guest pushed a commit to branch master
in repository game-data-packager.
commit d0568e7dc60e659842ea13f20a90e31e11099d27
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Tue Feb 16 15:46:38 2016 +0100
steam: do no throw exception when working offline
---
debian/changelog | 2 ++
game_data_packager/steam.py | 23 ++++++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index a30aece..9e2ad6f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ game-data-packager (45) UNRELEASED; urgency=medium
* Enhancements and bug fixes:
- Correct UnrealGoldPatch227i.7z's format [skitt]
- The Unreal patches provide lin_convenience_libs [skitt]
+ - Do not crash if there's no internet access and game
+ is possibly owned by user's Steam account [adetiste]
* Internal changes:
- Refactor dependency relationships and other distro- and
format-dependent values. They now take a map or list of
diff --git a/game_data_packager/steam.py b/game_data_packager/steam.py
index 9a4e729..87b2c99 100644
--- a/game_data_packager/steam.py
+++ b/game_data_packager/steam.py
@@ -65,15 +65,20 @@ def owned_steam_games(steam_id=None):
if steam_id is None:
return []
url = "http://steamcommunity.com/profiles/" + steam_id + "/games?xml=1"
- html = urllib.request.urlopen(urllib.request.Request(url, headers={'User-Agent': AGENT}))
- tree = xml.etree.ElementTree.ElementTree()
- tree.parse(html)
- games_xml = tree.getiterator('game')
- for game in games_xml:
- appid = int(game.find('appID').text)
- name = game.find('name').text
- #print(appid, name)
- owned_steam_games.STEAM_GAMES.append((appid, name))
+ try:
+ html = urllib.request.urlopen(urllib.request.Request(url, headers={'User-Agent': AGENT}))
+ tree = xml.etree.ElementTree.ElementTree()
+ tree.parse(html)
+ games_xml = tree.getiterator('game')
+ for game in games_xml:
+ appid = int(game.find('appID').text)
+ name = game.find('name').text
+ #print(appid, name)
+ owned_steam_games.STEAM_GAMES.append((appid, name))
+ except urllib.error.URLError as e:
+ # e="[Errno 111] Connection refused" but e.errno=None ?
+ pass
+
return owned_steam_games.STEAM_GAMES
owned_steam_games.STEAM_GAMES = None
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list