authomatic/providers/__init__.py
def _authorization_header(cls, credentials):
        """
        Creates authorization headers if the provider supports it. See:
        http://en.wikipedia.org/wiki/Basic_access_authentication.

        :param credentials:
            :class:`.Credentials`

        :returns:
            Headers as :class:`dict`.

        """

        if cls._x_use_authorization_header:
            res = ':'.join(
                (credentials.consumer_key,
                 credentials.consumer_secret))
            res = base64.b64encode(six.b(res)).decode()
            return {'Authorization': 'Basic {0}'.format(res)}
        else:
            return {}
def _authorization_header(cls, credentials):
        """
        Creates authorization headers if the provider supports it. See:
        http://en.wikipedia.org/wiki/Basic_access_authentication.

        :param credentials:
            :class:`.Credentials`

        :returns:
            Headers as :class:`dict`.

        """

        if cls._x_use_authorization_header:
            res = ':'.join(
                (credentials.consumer_key,
                 credentials.consumer_secret))
            res = base64.b64encode(six.b(res)).decode()
            return {'Authorization': 'Basic {0}'.format(res)}
        else:
            return {}
Creates authorization headers if the provider supports it. See:
        http://en.wikipedia.org/wiki/Basic_access_authentication.

        :param credentials:
            :class:`.Credentials`

        :returns:
            Headers as :class:`dict`.