Private GIT

Skip to content
Snippets Groups Projects
Commit 77f70ad0 authored by renini's avatar renini
Browse files

fix to work with new login system, check for http status 302

parent 0dba924e
Branches
Tags
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment