From e9a77f8da7d55ef5a18c846987ac16f6f4662c94 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 14 Jan 2012 11:45:55 +0100 Subject: [PATCH] Add headers to urlopener --- couchpotato/core/plugins/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index 05826609..3f9519cb 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -93,6 +93,12 @@ class Plugin(object): socket.setdefaulttimeout(timeout) + # Fill in some headers + if not headers.get('Referer'): + headers['Referer'] = urlparse(url).hostname + if not headers.get('User-Agent'): + headers['User-Agent'] = '' + host = urlparse(url).hostname self.wait(host)