1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-24 16:51:42 +00:00

FIX: 'Test SABnzbd' Button: Avoid the (silent) failure that occurs when a full API Key is specified instead of a NZB Key

The SABnzbd get_config API method does not return a status element on success so just rely on the absence of the 'host', 'nzb_key', and/or 'api_key' elements to get us into the exception block where the test against the NZBKey occurs.
This commit is contained in:
davalanche 2017-01-28 22:51:21 -06:00 committed by evilhero
parent 38ba9337c2
commit 9493bea29e

9
mylar/webserve.py Executable file → Normal file
View file

@ -4736,12 +4736,9 @@ class WebInterface(object):
return 'Unable to reach SABnzbd'
try:
if dom.getElementsByTagName('status')[0].firstChild.wholeText == 'True':
q_sabhost = dom.getElementsByTagName('host')[0].firstChild.wholeText
q_nzbkey = dom.getElementsByTagName('nzb_key')[0].firstChild.wholeText
q_apikey = dom.getElementsByTagName('api_key')[0].firstChild.wholeText
else:
raise ValueError
q_sabhost = dom.getElementsByTagName('host')[0].firstChild.wholeText
q_nzbkey = dom.getElementsByTagName('nzb_key')[0].firstChild.wholeText
q_apikey = dom.getElementsByTagName('api_key')[0].firstChild.wholeText
except:
errorm = dom.getElementsByTagName('error')[0].firstChild.wholeText
logger.error(u"Error detected attempting to retrieve SAB data using FULL APIKey: " + errorm)