def testAuthentication(host=None, username=None, password=None, apikey=None):
 params = {}
 params['mode'] = 'queue'
 params['output'] = 'json'
 params['ma_username'] = username
 params['ma_password'] = password
 params['apikey'] = apikey
 url = ((host + 'api?') + urllib.urlencode(params))
 logger.log((u'SABnzbd test URL: ' + url), logger.DEBUG)
 (result, f) = _sabURLOpenSimple(url)
 if (not result):
  return (False, f)
 (result, sabText) = _checkSabResponse(f)
 if (not result):
  return (False, sabText)
 return (True, 'Success')

def testAuthentication ( host = None , username = None , password = None , apikey = None ) : params = { } params [ 'mode' ] = 'queue' params [ 'output' ] = 'json' params [ 'ma_username' ] = username params [ 'ma_password' ] = password params [ 'apikey' ] = apikey url = ( ( host + 'api?' ) + urllib . urlencode ( params ) ) logger . log ( ( u'SABnzbd test URL: ' + url ) , logger . DEBUG ) ( result , f ) = _sabURLOpenSimple ( url ) if ( not result ) : return ( False , f ) ( result , sabText ) = _checkSabResponse ( f ) if ( not result ) : return ( False , sabText ) return ( True , 'Success' )
sends a simple api request to sab to determine if the given connection information is connect .