How to use the qualysapi.api_actions.QGActions function in qualysapi

To help you get started, we’ve selected a few qualysapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HASecuritySolutions / VulnWhisperer / deps / qualysapi / qualysapi / connector.py View on Github external
import qualysapi.api_methods

import qualysapi.api_actions
import qualysapi.api_actions as api_actions

# Setup module level logging.
logger = logging.getLogger(__name__)

try:
    from lxml import etree
except ImportError as e:
    logger.warning(
        'Warning: Cannot consume lxml.builder E objects without lxml. Send XML strings for AM & WAS API calls.')


class QGConnector(api_actions.QGActions):
    """ Qualys Connection class which allows requests to the QualysGuard API using HTTP-Basic Authentication (over SSL).

    """

    def __init__(self, auth, server='qualysapi.qualys.com', proxies=None, max_retries=3):
        # Read username & password from file, if possible.
        self.auth = auth
        # Remember QualysGuard API server.
        self.server = server
        # Remember rate limits per call.
        self.rate_limit_remaining = defaultdict(int)
        # api_methods: Define method algorithm in a dict of set.
        # Naming convention: api_methods[api_version optional_blah] due to api_methods_with_trailing_slash testing.
        self.api_methods = qualysapi.api_methods.api_methods
        #
        # Keep track of methods with ending slashes to autocorrect user when they forgot slash.