From 921524081c62d1941da2a0de3c1c837ceffcfc93 Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Wed, 13 Sep 2017 01:40:09 +0200 Subject: [PATCH 1/2] checkupdates: fix google play check method This has never worked with python3 and was also not properly adapted to apps as objects. So we fix both of these issues. --- fdroidserver/checkupdates.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 098280b2..856a514c 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -279,7 +279,7 @@ def check_gplay(app): req = urllib.request.Request(url, None, headers) try: resp = urllib.request.urlopen(req, None, 20) - page = resp.read() + page = resp.read().decode() except urllib.error.HTTPError as e: return (None, str(e.code)) except Exception as e: @@ -531,7 +531,7 @@ def main(): apps = common.read_app_args(options.appid, allapps, False) if options.gplay: - for app in apps: + for appid, app in apps.items(): version, reason = check_gplay(app) if version is None: if reason == '404': From 5ebde251b152035f17e5dbdf446629726efd2c7a Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Wed, 13 Sep 2017 01:42:15 +0200 Subject: [PATCH 2/2] checkupdates: use html.unescape instead of HTMLParser.unescape HTMLParser.unescape is only an internal method and deprecated. This requires Pyhton 3.4. --- fdroidserver/checkupdates.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 856a514c..217139d1 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -25,7 +25,7 @@ import time import subprocess from argparse import ArgumentParser import traceback -from html.parser import HTMLParser +import html from distutils.version import LooseVersion import logging import copy @@ -289,8 +289,7 @@ def check_gplay(app): m = re.search('itemprop="softwareVersion">[ ]*([^<]+)[ ]*', page) if m: - html_parser = HTMLParser() - version = html_parser.unescape(m.group(1)) + version = html.unescape(m.group(1)) if version == 'Varies with device': return (None, 'Device-variable version, cannot use this method')