username and password should only be set when it is intended that
    the default basic authentication mechanism using the API key be
    overridden (e.g. when using the apikey route with username and password).

def make_request(self, method, path, params={}, body="", username=None,
                     password=None, base_uri=None, content_type=None):
        headers = {
            'User-Agent': CreateSend.user_agent,
            'Content-Type': 'application/json; charset=utf-8',
            'Accept-Encoding': 'gzip, deflate'}
        if content_type:
            headers['Content-Type'] = content_type
        parsed_base_uri = urlparse(
            CreateSend.base_uri if not base_uri else base_uri)
        """username and password should only be set when it is intended that
    the default basic authentication mechanism using the API key be
    overridden (e.g. when using the apikey route with username and password)."""
        if username and password:
            headers['Authorization'] = "Basic %s" % base64.b64encode(
                ("%s:%s" % (username, password)).encode()).decode()
        elif self.auth_details:
            if 'api_key' in self.auth_details and self.auth_details['api_key']:
                headers['Authorization'] = "Basic %s" % base64.b64encode(
                    ("%s:x" % self.auth_details['api_key']).encode()).decode()
            elif 'access_token' in self.auth_details and self.auth_details['access_token']:
                headers['Authorization'] = "Bearer %s" % self.auth_details[
                    'access_token']
        self.headers = headers

        """If in fake web mode (i.e. self.stub_request has been called),
    self.faker should be set, and this request should be treated as a fake."""
        if self.fake_web:
            # Check that the actual url which would be requested matches
            # self.faker.url.
            actual_url = "https://%s%s" % (parsed_base_uri.netloc,
                                           self.build_url(parsed_base_uri, path, params))
            self.faker.actual_url = actual_url

            def same_urls(url_a, url_b):
                a = urlparse(url_a)
                b = urlparse(url_b)
                return (a.scheme == b.scheme and
                        a.netloc == b.netloc and
                        a.path == b.path and
                        a.params == b.params and
                        parse_qs(a.query) == parse_qs(b.query) and
                        a.fragment == b.fragment
                        )
            if not same_urls(self.faker.url, actual_url):
                raise Exception("Faker's expected URL (%s) doesn't match actual URL (%s)" % (
                    self.faker.url, actual_url))

            self.faker.actual_body = body

            def same_bodies(body_a, body_b):
                return json.loads(body_a) == json.loads(body_b)
            if self.faker.body is not None:
                if not same_bodies(self.faker.body, body):
                    raise Exception("Faker's expected body (%s) doesn't match actual body (%s)" % (
                        self.faker.body, body))

            data = self.faker.open() if self.faker else ''
            status = self.faker.status if (
                self.faker and self.faker.status) else 200
            return self.handle_response(status, data)

        c = VerifiedHTTPSConnection(parsed_base_uri.netloc, timeout=self.timeout)
        c.request(method, self.build_url(
            parsed_base_uri, path, params), body, headers)
        response = c.getresponse()
        if response.getheader('content-encoding', '') == 'gzip':
            data = gzip.GzipFile(fileobj=BytesIO(response.read())).read()
        else:
            data = response.read()
        c.close()
        return self.handle_response(response.status, data)