diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-09-08 12:34:07 +0200 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-09-08 12:34:07 +0200 |
commit | 75ad8b55c2af3a62be6272ef784a90aae9a20c4c (patch) | |
tree | 4feecef8ca24b7d297e1a40abf8d2b04e4d90d6c | |
parent | Changed the confirmation message when a new feed has been added. (diff) | |
download | newspipe-75ad8b55c2af3a62be6272ef784a90aae9a20c4c.tar.gz newspipe-75ad8b55c2af3a62be6272ef784a90aae9a20c4c.tar.bz2 newspipe-75ad8b55c2af3a62be6272ef784a90aae9a20c4c.zip |
Fixed bug in open_url().
-rwxr-xr-x | source/utils.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/utils.py b/source/utils.py index 4699a20b..4d3fb131 100755 --- a/source/utils.py +++ b/source/utils.py @@ -85,7 +85,7 @@ def opened_w_error(filename, mode="r"): def open_url(url): """ - Open an URL with proxy and the user-agent + Open an URL with the proxy and the user-agent specified in the configuration file. """ if conf.HTTP_PROXY == "": @@ -99,20 +99,21 @@ def open_url(url): return (True, opener.open(url)) except urllib.error.HTTPError as e: # server couldn't fulfill the request - errors.append((url, e.code, \ - http.server.BaseHTTPRequestHandler.responses[e.code][1])) + error = (url, e.code, \ + http.server.BaseHTTPRequestHandler.responses[e.code][1]) pyaggr3g470r_log.error(url + " " + e.code + " " + \ http.server.BaseHTTPRequestHandler.responses[e.code][1]) + return (False, error) except urllib.error.URLError as e: # failed to reach the server if type(e.reason) == str: - errors.append((url, e.reason, e.reason)) - pyaggr3g470r_log.error(URL + " " + e.reason) + error = (url, e.reason, e.reason) + pyaggr3g470r_log.error(url + " " + e.reason) else: - errors.append((url, e.reason.errno, e.reason.strerror)) - pyaggr3g470r_log.error(URL + " " + e.reason.errno + " " + \ + error = (url, e.reason.errno, e.reason.strerror) + pyaggr3g470r_log.error(url + " " + e.reason.errno + " " + \ e.reason.strerror) - return (False, errors) + return (False, error) def generate_qr_code(article): """ |