From 26a4de4ccd3bfc5b1672cfbddbb71fd378069658 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Fri, 27 Jan 2012 19:18:16 +0000 Subject: [PATCH] A couple of minor update checking improvements --- checkupdates.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/checkupdates.py b/checkupdates.py index 2532768d..0ccb8987 100755 --- a/checkupdates.py +++ b/checkupdates.py @@ -37,7 +37,12 @@ execfile('config.py') def check_market(app): time.sleep(5) url = 'http://market.android.com/details?id=' + app['id'] - page = urllib.urlopen(url).read() + req = urllib.urlopen(url) + if req.getcode() == 404: + return (None, 'Not in market') + elif req.getcode() != 200: + return (None, 'Return code ' + str(req.getcode())) + page = req.read() version = None vercode = None @@ -46,6 +51,9 @@ def check_market(app): if m: version = html_parser.unescape(m.group(1)) + if version == 'Varies with device': + return (None, 'Device-variable version, cannot use this method') + m = re.search('data-paramValue="(\d+)">
Latest Version<', page) if m: vercode = m.group(1)