blob: 9de2a8c4b0776a89e97d45de8cc16a42060e5b82 [file] [log] [blame]
from requests.auth import AuthBase
__author__ = 'hanl'
class Oauth2Auth(AuthBase):
'''
starts needs to match the provider name
'''
def __init__(self, token=None):
self.token = token
def __call__(self, r):
if self.token is not None:
r.headers['Authorization'] = "OAuth2 Bearer " + self.token
return r
class CustomAuth(AuthBase):
def __init__(self, token=None):
self.token = token
def __call__(self, r):
if self.token is not None:
r.headers['Authorization'] = "api_token " + self.token
return r