Private GIT

Skip to content
Snippets Groups Projects
Commit 0bf673e5 authored by echel0n's avatar echel0n
Browse files

Merge pull request #1139 from renini/develop

mediaToSickbeard.p fix to work with new login system, check for http status 302
parents b255f5d0 77f70ad0
No related branches found
No related tags found
No related merge requests found
...@@ -190,18 +190,21 @@ def main(): ...@@ -190,18 +190,21 @@ def main():
host = 'localhost' host = 'localhost'
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode" 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)) scriptlogger.debug("Opening URL: " + url + ' with params=' + str(params))
print "Opening URL: " + url + ' with params=' + str(params) print "Opening URL: " + url + ' with params=' + str(params)
try: 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: except Exception, e:
scriptlogger.error(u': Unknown exception raised when opening url: ' + str(e)) scriptlogger.error(u': Unknown exception raised when opening url: ' + str(e))
time.sleep(3) time.sleep(3)
sys.exit() sys.exit()
if response.status_code == 401: if response.status_code == 302:
scriptlogger.error(u'Invalid Sickbeard Username or Password, check your config') scriptlogger.error(u'Invalid Sickbeard Username or Password, check your config')
print 'Invalid Sickbeard Username or Password, check your config' print 'Invalid Sickbeard Username or Password, check your config'
time.sleep(3) time.sleep(3)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment