From 4eb900067658d8c6c50393bb73144211fb11eec3 Mon Sep 17 00:00:00 2001 From: tehspede Date: Wed, 23 Apr 2014 00:29:03 +0300 Subject: [PATCH] Fixes error "Invalid username or password for SceneAccess Check your settings" --- sickbeard/providers/scc.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sickbeard/providers/scc.py b/sickbeard/providers/scc.py index 1e563c13..ce82b77c 100644 --- a/sickbeard/providers/scc.py +++ b/sickbeard/providers/scc.py @@ -83,7 +83,8 @@ class SCCProvider(generic.TorrentProvider): self.session = requests.Session() try: - response = self.session.post(self.urls['login'], data=login_params, timeout=30, verify=False) + headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'} + response = self.session.post(self.urls['login'], data=login_params, headers=headers, timeout=30, verify=False) except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e: logger.log(u'Unable to connect to ' + self.name + ' provider: ' + ex(e), logger.ERROR) return False @@ -230,15 +231,19 @@ class SCCProvider(generic.TorrentProvider): self._doLogin() if not headers: - headers = [] + headers = {} + + headers.update({'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}) try: - # Remove double-slashes from url + # Remove double-slashes from url parsed = list(urlparse.urlparse(url)) parsed[2] = re.sub("/{2,}", "/", parsed[2]) # replace two or more / with one url = urlparse.urlunparse(parsed) - - response = self.session.get(url, verify=False) + + + + response = self.session.get(url, headers=headers, verify=False) except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e: logger.log(u"Error loading " + self.name + " URL: " + ex(e), logger.ERROR) return None