Allow auth using a pre-fetched token

Change-Id: I6ed13d969410be83ebfce443d5758a7d0b98386b
This commit is contained in:
Kiall Mac Innes 2013-08-08 01:02:11 +01:00
parent 7d142020d8
commit bd8023493a

View File

@ -52,6 +52,10 @@ class Client(object):
raise ValueError('Either an endpoint or auth_url must be supplied')
headers = {'Content-Type': 'application/json'}
if token is not None:
headers['X-Auth-Token'] = token
self.requests = requests.Session()
self.requests.auth = auth
self.requests.headers.update(headers)