# Path: gnsq/errors.py
# class NSQHttpError(NSQException):
#     pass
# 
# Path: gnsq/version.py



import json
import urllib3
from .errors import NSQHttpError
from .version import __version__
        return self._connection.scheme

    @property
    def host(self):
        return self._connection.host

    @property
    def port(self):
        return self._connection.port

    @property
    def address(self):
        return '{}://{}:{}/'.format(self.scheme, self.host, self.port)

    def _request(self, method, url, headers={}, fields=None, **kwargs):
        headers = dict(headers)
        headers.setdefault('Accept', 'application/vnd.nsq version=1.0')
        headers.setdefault('User-Agent', self.useragent)

        response = self._connection.request_encode_url(
            method, url, headers=_encode_dict(headers),
            fields=_encode_dict(fields), **kwargs)

        if 'application/json' in response.getheader('content-type', ''):
            return self._http_check_json(response)

        return self._http_check(response)

    def _http_check(self, response):
        if response.status != 200:

# Path: gnsq/errors.py
# class NSQHttpError(NSQException):
#     pass
# 
# Path: gnsq/version.py



# Path: gnsq/httpclient.py
import json
import urllib3
from .errors import NSQHttpError
from .version import __version__

        return self._connection.scheme

    @property
    def host(self):
        return self._connection.host

    @property
    def port(self):
        return self._connection.port

    @property
    def address(self):
        return '{}://{}:{}/'.format(self.scheme, self.host, self.port)

    def _request(self, method, url, headers={}, fields=None, **kwargs):
        headers = dict(headers)
        headers.setdefault('Accept', 'application/vnd.nsq version=1.0')
        headers.setdefault('User-Agent', self.useragent)

        response = self._connection.request_encode_url(
            method, url, headers=_encode_dict(headers),
            fields=_encode_dict(fields), **kwargs)

        if 'application/json' in response.getheader('content-type', ''):
            return self._http_check_json(response)

        return self._http_check(response)

    def _http_check(self, response):
        if response.status != 200:

            raise NSQHttpError('http error <{}>'.format(response.status))