""" A set of utility functions for QualysConnect module. """
import logging

import qualysconnect.config as qcconf
import qualysconnect.connect as qcconn

__author__ = "Parag Baxi <parag.baxi@gmail.com> & Colin Bell <colin.bell@uwaterloo.ca>"
__copyright__ = "Copyright 2011-2013, Parag Baxi & University of Waterloo"
__license__ = "BSD-new"

# define global values used by community code. will standardize debugging later.
package = 'qualysconnect'
module = 'util.py'
from . import __version__ as version

# Define a Handler which writes WARNING messages or higher to the sys.stderr
logger_console = logging.StreamHandler()
logger_console.setLevel(logging.ERROR)
# Set a format which is simpler for console use.
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
# Tell the handler to use this format.
logger_console.setFormatter(formatter)
# Add the handler to the root logger
logging.getLogger(__name__).addHandler(logger_console)
# Set module level logger.
logger = logging.getLogger(__name__)

def connect():
    """ Return a QGAPIConnect object for v1 API pulling settings from config
    file.
    """
    conf = qcconf.QualysConnectConfig()
    connect = qcconn.QGAPIConnect(conf.get_username(),
                                  conf.get_password(),
                                  conf.get_hostname())
    logger.info("Finished building connector.")
    return connect

Create util.py