Mercurial > farol > farol
comparison farol/main.py @ 172:964d7caf70b0 1.1.0
Really fix the User-Agent issue.
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Mon, 05 Jan 2015 14:18:34 +0100 |
parents | 000114da182d |
children |
comparison
equal
deleted
inserted
replaced
171:62c482ae1755 | 172:964d7caf70b0 |
---|---|
118 proxy_host = app.config.get('PROXY_HOST', '') | 118 proxy_host = app.config.get('PROXY_HOST', '') |
119 if proxy_host: | 119 if proxy_host: |
120 proxy = urllib2.ProxyHandler({'http': proxy_host, 'https': proxy_host}) | 120 proxy = urllib2.ProxyHandler({'http': proxy_host, 'https': proxy_host}) |
121 opener = urllib2.build_opener(proxy) | 121 opener = urllib2.build_opener(proxy) |
122 urllib2.install_opener(opener) | 122 urllib2.install_opener(opener) |
123 try: content = urllib2.urlopen(url).read() | 123 try: content = urllib2.urlopen(request).read() |
124 except urllib2.HTTPError as e: | 124 except urllib2.HTTPError as e: |
125 flash('Unable to retrieve %s: %s' % (url, e)) | 125 flash('Unable to retrieve %s: %s' % (url, e)) |
126 return | 126 return |
127 set_text(content) | 127 set_text(content) |
128 | 128 |