Allow auth using a pre-fetched token
Change-Id: I6ed13d969410be83ebfce443d5758a7d0b98386b
This commit is contained in:
parent
7d142020d8
commit
bd8023493a
@ -52,6 +52,10 @@ class Client(object):
|
|||||||
raise ValueError('Either an endpoint or auth_url must be supplied')
|
raise ValueError('Either an endpoint or auth_url must be supplied')
|
||||||
|
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
if token is not None:
|
||||||
|
headers['X-Auth-Token'] = token
|
||||||
|
|
||||||
self.requests = requests.Session()
|
self.requests = requests.Session()
|
||||||
self.requests.auth = auth
|
self.requests.auth = auth
|
||||||
self.requests.headers.update(headers)
|
self.requests.headers.update(headers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user