diff options
author | Lucas C. Villa Real <lucasvr@gobolinux.org> | 2018-07-04 12:56:10 -0300 |
---|---|---|
committer | Lucas C. Villa Real <lucasvr@gobolinux.org> | 2018-07-04 12:56:10 -0300 |
commit | 09b7e525463b720e107ae32b9b714621b12513c3 (patch) | |
tree | e244471dccfddde7b70df7ea54e662f9687e8964 /bin/RPMFinder | |
parent | 1f6e3b99baf2d9e85139cc46f68dd55813886ff1 (diff) | |
download | ThirdPartyInstallers-09b7e525463b720e107ae32b9b714621b12513c3.tar.xz |
Catch errors while retrieving data from remote URLs
Diffstat (limited to 'bin/RPMFinder')
-rwxr-xr-x | bin/RPMFinder | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bin/RPMFinder b/bin/RPMFinder index d1c9b03..1811222 100755 --- a/bin/RPMFinder +++ b/bin/RPMFinder @@ -239,11 +239,19 @@ class RPMFinder: query = "/linux/rpm2html/search.php" query += "?query={0}&submit=Search+...&system={1}&arch={2}".format(path, self.distroname, arch) htmlparser = RPMFind_Parser() - html = subprocess.check_output(["wget", "--quiet", "{0}{1}".format(self.baseuri, query), "-O", "-"]) - htmlparser.feed(str(html)) - for infopage in htmlparser.get_pkginfo().infopages: - html = subprocess.check_output(["wget", "--quiet", "{0}{1}".format(self.baseuri, infopage), "-O", "-"]) + try: + html = subprocess.check_output(["wget", "--quiet", "{0}{1}".format(self.baseuri, query), "-O", "-"]) htmlparser.feed(str(html)) + except subprocess.CalledProcessError: + sys.stderr.write("error retrieving url {0}{1}".format(self.baseuri, query)) + return None + for infopage in htmlparser.get_pkginfo().infopages: + try: + html = subprocess.check_output(["wget", "--quiet", "{0}{1}".format(self.baseuri, infopage), "-O", "-"]) + htmlparser.feed(str(html)) + except subprocess.CalledProcessError: + sys.stderr.write("error retrieving url {0}{1}".format(self.baseuri, infopage)) + return None return htmlparser.get_pkginfo(self.baseuri) |