From f9c61cbd2a4f44a84367f163d0258f676acb1f17 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sun, 14 Feb 2016 11:41:59 +0100 Subject: Removed proxy support. Not so used and better to set at the system level. --- src/web/utils.py | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/web') diff --git a/src/web/utils.py b/src/web/utils.py index 9e3ad3ed..f770f597 100755 --- a/src/web/utils.py +++ b/src/web/utils.py @@ -241,34 +241,6 @@ def clean_url(url): parsed_url.fragment ]).rstrip('=') -def open_url(url): - """ - Open an URL with the proxy and the user-agent - specified in the configuration file. - """ - if conf.HTTP_PROXY == "": - proxy = {} - else: - proxy = {"http": conf.HTTP_PROXY} - opener = urllib.request.FancyURLopener(proxy) - try: - opener = urllib.request.build_opener() - opener.addheaders = [('User-agent', conf.USER_AGENT)] - return (True, opener.open(url)) - except urllib.error.HTTPError as e: - # server couldn't fulfill the request - 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: - error = (url, e.reason, e.reason) - else: - error = (url, e.reason.errno, e.reason.strerror) - return (False, error) - - def load_stop_words(): """ Load the stop words and return them in a list. -- cgit