def connect( config_file=qcs.default_filename, section="info", remember_me=False, remember_me_always=False, username=None, password=None, hostname="qualysapi.qualys.com", max_retries="3", proxies=None, ): """ Return a QGAPIConnect object for v1 API pulling settings from config file. """ # Use function parameter login credentials. if username and password: connect = qcconn.QGConnector(auth=(username, password), server=hostname, max_retries=max_retries, proxies=proxies) # Retrieve login credentials from config file. else: conf = qcconf.QualysConnectConfig( filename=config_file, section=section, remember_me=remember_me, remember_me_always=remember_me_always, ) connect = qcconn.QGConnector(conf.get_auth(), conf.get_hostname(), conf.proxies, conf.max_retries) logger.info("Finished building connector.") return connect
def connect(config_file=qcs.default_filename, section='info', remember_me=False, remember_me_always=False): """ Return a QGAPIConnect object for v1 API pulling settings from config file. """ # Retrieve login credentials. conf = qcconf.QualysConnectConfig(filename=config_file, section=section, remember_me=remember_me, remember_me_always=remember_me_always) connect = qcconn.QGConnector(conf.get_auth(), conf.get_hostname(), conf.proxies, conf.max_retries) logger.info("Finished building connector.") return connect
def __init__(self): self.client = qcconn.QGConnector( (environ.get('QUALYS_LOGIN'), environ.get('QUALYS_PASSWORD')), environ.get('QUALYS_API_SERVER'), None, 5) self.status_check_errors = 0