1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00

A couple of minor update checking improvements

This commit is contained in:
Ciaran Gultnieks 2012-01-27 19:18:16 +00:00
parent 229d5f15ff
commit 26a4de4ccd

View File

@ -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+)"><div class="goog-menuitem-content">Latest Version<', page)
if m:
vercode = m.group(1)