'Make a HTTP request to the InfluxDB API.
:param url: the path of the HTTP request, e.g. write, query, etc.
:type url: str
:param method: the HTTP method for the request, defaults to GET
:type method: str
:param params: additional parameters for the request, defaults to None
:type params: dict
:param data: the data of the request, defaults to None
:type data: str
:param expected_response_code: the expected response code of
the request, defaults to 200
:type expected_response_code: int
:param headers: headers to add to the request
:type headers: dict
:returns: the response from the request
:rtype: :class:`requests.Response`
:raises InfluxDBServerError: if the response code is any server error
code (5xx)
:raises InfluxDBClientError: if the response code is not the
same as `expected_response_code` and is not a server error code'

def request(self, url, method=u'GET', params=None, data=None, expected_response_code=200, headers=None):

    url = u'{0}/{1}'.format(self._baseurl, url)
    if (headers is None):
        headers = self._headers
    if (params is None):
        params = {}
    if isinstance(data, (dict, list)):
        data = json.dumps(data)
    retry = True
    _try = 0
    while retry:
        try:
            response = self._session.request(method=method, url=url, auth=(self._username, self._password), params=params, data=data, headers=headers, proxies=self._proxies, verify=self._verify_ssl, timeout=self._timeout)
            break
        except requests.exceptions.ConnectionError:
            _try += 1
            if (self._retries != 0):
                retry = (_try < self._retries)
    else:
        raise requests.exceptions.ConnectionError
    if (500 <= response.status_code < 600):
        raise InfluxDBServerError(response.content)
    elif (response.status_code == expected_response_code):
        return response
    else:
        raise InfluxDBClientError(response.content, response.status_code)
