# Path: osprofiler/drivers/base.py
# LOG = logging.getLogger(__name__)
# def get_driver(connection_string, *args, **kwargs):
#     def __init__(self, connection_str, project=None, service=None, host=None,
#                  **kwargs):
#     def notify(self, info, **kwargs):
#     def get_report(self, base_id):
#     def get_name(cls):
#     def list_traces(self, fields=None):
#     def list_error_traces(self):
#     def _build_tree(nodes):
#     def _append_results(self, trace_id, parent_id, name, project, service,
#                         host, timestamp, raw_payload=None):
#     def _parse_results(self):
#         def msec(dt):
# class Driver(object):
# 
# Path: osprofiler/exc.py
# class CommandError(Exception):
# class LogInsightAPIError(Exception):
# class LogInsightLoginTimeout(Exception):
#     def __init__(self, message=None):
#     def __str__(self):


import json
import logging as log
import netaddr
import requests
from urllib import parse as urlparse
from oslo_concurrency.lockutils import synchronized
from osprofiler.drivers import base
from osprofiler import exc
        self._username = username
        self._password = password
        self._api_port = api_port
        self._api_ssl_port = api_ssl_port
        self._query_timeout = query_timeout
        self._session = requests.Session()
        self._session_id = None

    def _build_base_url(self, scheme):
        proto_str = "%s://" % scheme
        host_str = ("[%s]" % self._host if netaddr.valid_ipv6(self._host)
                    else self._host)
        port_str = ":%d" % (self._api_ssl_port if scheme == "https"
                            else self._api_port)
        return proto_str + host_str + port_str

    def _check_response(self, resp):
        if resp.status_code == 440:
            raise exc.LogInsightLoginTimeout()

        if not resp.ok:
            msg = "n/a"
            if resp.text:
                try:
                    body = json.loads(resp.text)
                    msg = body.get("errorMessage", msg)
                except ValueError:
                    pass
            else:
                msg = resp.reason

# Path: osprofiler/drivers/base.py
# LOG = logging.getLogger(__name__)
# def get_driver(connection_string, *args, **kwargs):
#     def __init__(self, connection_str, project=None, service=None, host=None,
#                  **kwargs):
#     def notify(self, info, **kwargs):
#     def get_report(self, base_id):
#     def get_name(cls):
#     def list_traces(self, fields=None):
#     def list_error_traces(self):
#     def _build_tree(nodes):
#     def _append_results(self, trace_id, parent_id, name, project, service,
#                         host, timestamp, raw_payload=None):
#     def _parse_results(self):
#         def msec(dt):
# class Driver(object):
# 
# Path: osprofiler/exc.py
# class CommandError(Exception):
# class LogInsightAPIError(Exception):
# class LogInsightLoginTimeout(Exception):
#     def __init__(self, message=None):
#     def __str__(self):


# Path: osprofiler/drivers/loginsight.py
import json
import logging as log
import netaddr
import requests
from urllib import parse as urlparse
from oslo_concurrency.lockutils import synchronized
from osprofiler.drivers import base
from osprofiler import exc

        self._username = username
        self._password = password
        self._api_port = api_port
        self._api_ssl_port = api_ssl_port
        self._query_timeout = query_timeout
        self._session = requests.Session()
        self._session_id = None

    def _build_base_url(self, scheme):
        proto_str = "%s://" % scheme
        host_str = ("[%s]" % self._host if netaddr.valid_ipv6(self._host)
                    else self._host)
        port_str = ":%d" % (self._api_ssl_port if scheme == "https"
                            else self._api_port)
        return proto_str + host_str + port_str

    def _check_response(self, resp):
        if resp.status_code == 440:
            raise exc.LogInsightLoginTimeout()

        if not resp.ok:
            msg = "n/a"
            if resp.text:
                try:
                    body = json.loads(resp.text)
                    msg = body.get("errorMessage", msg)
                except ValueError:
                    pass
            else:
                msg = resp.reason

            raise exc.LogInsightAPIError(msg)