From d3213ea1e7d00cdd2a50eb124ee9c449fde4d364 Mon Sep 17 00:00:00 2001 From: pictuga Date: Wed, 17 Jul 2013 14:40:29 +0200 Subject: [PATCH] Implement user-agent in HTMLDownloader It was forgotten in the previous commit --- morss.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/morss.py b/morss.py index 64b16b9..245ddbe 100644 --- a/morss.py +++ b/morss.py @@ -189,13 +189,14 @@ class HTMLDownloader(urllib2.HTTPCookieProcessor): Custom urllib2 handler to download html pages, following redirects, using a browser user-agent and storing cookies. """ - def __init__(self, cookiejar=None): + def __init__(self, useragent=UA_HML, cookiejar=None): urllib2.HTTPCookieProcessor.__init__(self, cookiejar) - self.userAgent = UA_HML + self.useragent = useragent def http_request(self, req): urllib2.HTTPCookieProcessor.http_request(self, req) req.add_header('Accept-Encoding', 'gzip') + req.add_header('User-Agent', self.useragent) return req def http_response(self, req, resp):