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)