Mercurial > farol
changeset 159:5df0bef667ea
Set the User-Agent for external requests
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Mon, 22 Dec 2014 15:26:48 +0100 |
parents | d66532e1909e |
children | 4d8218fbe686 |
files | CHANGES farol/main.py |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES Mon Nov 17 16:51:00 2014 +0100 +++ b/CHANGES Mon Dec 22 15:26:48 2014 +0100 @@ -1,3 +1,10 @@ +Farol next +======================= + +Main changes since 1.0.1: +------------------------- +* Set the User-Agent to external requests to a non-default value. + Farol 1.0.1 (2014-11-17) ========================
--- a/farol/main.py Mon Nov 17 16:51:00 2014 +0100 +++ b/farol/main.py Mon Dec 22 15:26:48 2014 +0100 @@ -109,6 +109,11 @@ ) def download_url(url): + request = urllib2.Request(url) + request.add_header('User-Agent', + app.config.get('USER_AGENT', + 'Farol %s / FarolLuz %s' % ( + __version__, farolluz.__version__))) proxy_host = app.config.get('PROXY_HOST', '') if proxy_host: proxy = urllib2.ProxyHandler({'http': proxy_host, 'https': proxy_host})