# Path: barbicanclient/exceptions.py
# class BarbicanException(Exception):
# class PayloadException(BarbicanException):
# class UnsupportedVersion(BarbicanException):
# class HTTPError(Exception):
# class HTTPServerError(HTTPError):
# class HTTPClientError(HTTPError):
# class HTTPAuthError(HTTPError):
#     def __init__(self, message, status_code=0):
#     def __init__(self, message, status_code=401):


import importlib
import logging
import os
import sys
import warnings
from keystoneauth1 import adapter
from keystoneauth1 import session as ks_session
from oslo_utils import importutils
from barbicanclient import exceptions
        return resp

    def get(self, *args, **kwargs):
        headers = kwargs.setdefault('headers', {})
        headers.setdefault('Accept', 'application/json')

        return super(_HTTPClient, self).get(*args, **kwargs).json()

    def post(self, path, *args, **kwargs):
        path = self._fix_path(path)

        return super(_HTTPClient, self).post(path, *args, **kwargs).json()

    def _fix_path(self, path):
        if not path[-1] == '/':
            path += '/'
        return path

    def _get_raw(self, path, *args, **kwargs):
        return self.request(path, 'GET', *args, **kwargs).content

    def _check_status_code(self, resp):
        status = resp.status_code
        LOG.debug('Response status {0}'.format(status))
        if status == 401:
            LOG.error('Auth error: {0}'.format(self._get_error_message(resp)))
            raise exceptions.HTTPAuthError(
                '{0}'.format(self._get_error_message(resp))
            )
        if not status or status >= 500:

# Path: barbicanclient/exceptions.py
# class BarbicanException(Exception):
# class PayloadException(BarbicanException):
# class UnsupportedVersion(BarbicanException):
# class HTTPError(Exception):
# class HTTPServerError(HTTPError):
# class HTTPClientError(HTTPError):
# class HTTPAuthError(HTTPError):
#     def __init__(self, message, status_code=0):
#     def __init__(self, message, status_code=401):


# Path: barbicanclient/client.py
import importlib
import logging
import os
import sys
import warnings
from keystoneauth1 import adapter
from keystoneauth1 import session as ks_session
from oslo_utils import importutils
from barbicanclient import exceptions

        return resp

    def get(self, *args, **kwargs):
        headers = kwargs.setdefault('headers', {})
        headers.setdefault('Accept', 'application/json')

        return super(_HTTPClient, self).get(*args, **kwargs).json()

    def post(self, path, *args, **kwargs):
        path = self._fix_path(path)

        return super(_HTTPClient, self).post(path, *args, **kwargs).json()

    def _fix_path(self, path):
        if not path[-1] == '/':
            path += '/'
        return path

    def _get_raw(self, path, *args, **kwargs):
        return self.request(path, 'GET', *args, **kwargs).content

    def _check_status_code(self, resp):
        status = resp.status_code
        LOG.debug('Response status {0}'.format(status))
        if status == 401:
            LOG.error('Auth error: {0}'.format(self._get_error_message(resp)))
            raise exceptions.HTTPAuthError(
                '{0}'.format(self._get_error_message(resp))
            )
        if not status or status >= 500:

            LOG.error('5xx Server error: {0}'.format(