How to use the urllib3.util.make_headers function in urllib3

To help you get started, we’ve selected a few urllib3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cliffano / swaggy-jenkins / clients / python / generated / swaggyjenkins / configuration.py View on Github external
def get_basic_auth_token(self):
        """Gets HTTP basic authentication header (string).

        :return: The token for basic HTTP authentication.
        """
        return urllib3.util.make_headers(
            basic_auth=self.username + ':' + self.password
        ).get('authorization')
github ARMmbed / mbed-cloud-sdk-python / src / mbed_cloud / _backends / connector_bootstrap / configuration.py View on Github external
def get_basic_auth_token(self):
        """Gets HTTP basic authentication header (string).

        :return: The token for basic HTTP authentication.
        """
        return urllib3.util.make_headers(basic_auth=self.username + ':' + self.password)\
                           .get('authorization')
github OpenAPITools / openapi-generator / samples / openapi3 / client / petstore / python / petstore_api / configuration.py View on Github external
def get_basic_auth_token(self):
        """Gets HTTP basic authentication header (string).

        :return: The token for basic HTTP authentication.
        """
        return urllib3.util.make_headers(
            basic_auth=self.username + ':' + self.password
        ).get('authorization')
github ms32035 / firefly-iii-client / firefly_iii_client / configuration.py View on Github external
def get_basic_auth_token(self):
        """Gets HTTP basic authentication header (string).

        :return: The token for basic HTTP authentication.
        """
        return urllib3.util.make_headers(
            basic_auth=self.username + ':' + self.password
        ).get('authorization')
github muxinc / mux-python / mux_python / configuration.py View on Github external
def get_basic_auth_token(self):
        """Gets HTTP basic authentication header (string).

        :return: The token for basic HTTP authentication.
        """
        return urllib3.util.make_headers(
            basic_auth=self.username + ':' + self.password
        ).get('authorization')
github Azure / azure-cli / src / azure-cli / azure / cli / command_modules / botservice / kudu_client.py View on Github external
:return: None
        """
        user_name, password = WebAppOperations.get_site_credential(self.__cmd.cli_ctx,
                                                                   self.__resource_group_name,
                                                                   self.bot_site_name,
                                                                   None)

        # Store the password for download_bot_zip:
        self.__password = password
        self.__scm_url = WebAppOperations.get_scm_url(self.__cmd,
                                                      self.__resource_group_name,
                                                      self.bot_site_name,
                                                      None)

        self.__auth_headers = urllib3.util.make_headers(basic_auth='{0}:{1}'.format(user_name, password))
        self.__initialized = True
github builderscon / octav / py / octav.py View on Github external
raise MissingRequiredArgument('property email must be provided')
        payload['email'] = email
        if target_id is None:
            raise MissingRequiredArgument('property target_id must be provided')
        payload['target_id'] = target_id
        if user_id is None:
            raise MissingRequiredArgument('property user_id must be provided')
        payload['user_id'] = user_id
        if email is not None:
            payload['email'] = email
        if target_id is not None:
            payload['target_id'] = target_id
        if user_id is not None:
            payload['user_id'] = user_id
        uri = '%s/v1/email/create' % self.endpoint
        hdrs = urllib3.util.make_headers(
            basic_auth='%s:%s' % (self.key, self.secret),
        )
        if self.debug:
            print('POST %s' % uri)
        hdrs['Content-Type']= 'application/json'
        res = self.http.request('POST', uri, headers=hdrs, body=json.dumps(payload))
        if self.debug:
            print(res)
        self.res = res
        if res.status != 200:
            self.extract_error(res)
            return None
        return json.loads(res.data)
    except BaseException as e:
        if self.debug:
            print("error during http access: " + repr(e))
github NVIDIA / aistore / python-client / openapi_client / configuration.py View on Github external
def get_basic_auth_token(self):
        """Gets HTTP basic authentication header (string).

        :return: The token for basic HTTP authentication.
        """
        return urllib3.util.make_headers(
            basic_auth=self.username + ':' + self.password
        ).get('authorization')
github BitMEX / api-connectors / clients / python / swagger_client / configuration.py View on Github external
def get_basic_auth_token(self):
        """
        Gets HTTP basic authentication header (string).

        :return: The token for basic HTTP authentication.
        """
        return urllib3.util.make_headers(basic_auth=self.username + ':' + self.password)\
                           .get('authorization')
github Isilon / isilon_sdk_python / isi_sdk_8_2_0 / isi_sdk_8_2_0 / configuration.py View on Github external
def get_basic_auth_token(self):
        """Gets HTTP basic authentication header (string).

        :return: The token for basic HTTP authentication.
        """
        return urllib3.util.make_headers(
            basic_auth=self.username + ':' + self.password
        ).get('authorization')