1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

Merge pull request #1139 from renini/develop

mediaToSickbeard.p fix to work with new login system, check for http status 302
This commit is contained in:
echel0n 2014-12-14 21:32:36 -08:00
commit 0bf673e57c

View File

@ -190,18 +190,21 @@ def main():
host = 'localhost'
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode"
login_url = protocol + host + ":" + port + web_root + "/login"
scriptlogger.debug("Opening URL: " + url + ' with params=' + str(params))
print "Opening URL: " + url + ' with params=' + str(params)
try:
response = requests.get(url, auth=(username, password), params=params, verify=False)
sess = requests.Session()
sess.post(login_url, data={'username': username, 'password': password}, stream=True, verify=False)
response = sess.get(url, auth=(username, password), params=params, verify=False, allow_redirects=False)
except Exception, e:
scriptlogger.error(u': Unknown exception raised when opening url: ' + str(e))
time.sleep(3)
sys.exit()
if response.status_code == 401:
if response.status_code == 302:
scriptlogger.error(u'Invalid Sickbeard Username or Password, check your config')
print 'Invalid Sickbeard Username or Password, check your config'
time.sleep(3)