'Make a http request to API.'

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

    url = '{0}/{1}'.format(self._baseurl, url)
    if (params is None):
        params = {}
    auth = {'u': self._username, 'p': self._password}
    params.update(auth)
    if ((data is not None) and (not isinstance(data, str))):
        data = json.dumps(data)
    retry = True
    _try = 0
    while retry:
        try:
            response = session.request(method=method, url=url, params=params, data=data, headers=self._headers, verify=self._verify_ssl, timeout=self._timeout)
            break
        except (requests.exceptions.ConnectionError, requests.exceptions.Timeout):
            _try += 1
            if (self._retries != 0):
                retry = (_try < self._retries)
    else:
        raise requests.exceptions.ConnectionError
    if (response.status_code == expected_response_code):
        return response
    else:
        raise InfluxDBClientError(response.content, response.status_code)
