from requests.auth import AuthBase


class HTTPENotasBasicAuth(AuthBase):

    def __init__(self, token):
        self.token = token

    def __eq__(self, other):
        return self.token == getattr(other, 'token', None)

    def __ne__(self, other):
        return not self == other

    def __call__(self, r):
        r.headers['Authorization'] = 'Basic {0}'.format(self.token)
        return r
