Make glanceclient accept a session object

To make this work we create a different HTTPClient that extends the
basic keystoneclient Adapter. The Adapter is a standard set of
parameters that all clients should know how to use like region_name and
user_agent. We extend this with the glance specific response
manipulation like loading and sending iterables.

Implements: bp session-objects
Change-Id: Ie8eb4bbf7d1a037099a6d4b272cab70525fbfc85
This commit is contained in:
Jamie Lennox
2014-11-25 13:25:12 +10:00
committed by Flavio Percoco
parent db6420b447
commit 5ce9c7dc96
7 changed files with 205 additions and 93 deletions
+3 -4
View File
@@ -29,10 +29,9 @@ class Client(object):
http requests. (optional)
"""
def __init__(self, endpoint, **kwargs):
def __init__(self, endpoint=None, **kwargs):
"""Initialize a new client for the Images v1 API."""
endpoint, version = utils.strip_version(endpoint)
self.version = version or 1.0
self.http_client = http.HTTPClient(endpoint, **kwargs)
endpoint, self.version = utils.endpoint_version_from_url(endpoint, 1.0)
self.http_client = http.get_http_client(endpoint=endpoint, **kwargs)
self.images = ImageManager(self.http_client)
self.image_members = ImageMemberManager(self.http_client)