In order to use the python api directly, you must first obtain an auth token and identify which endpoint you wish to speak to. Once you have done so, you can use the API like so:
>>> from glanceclient import Client
>>> glance = Client('1', endpoint=OS_IMAGE_ENDPOINT, token=OS_AUTH_TOKEN)
>>> image = glance.images.create(name="My Test Image")
>>> print image.status
'queued'
>>> image.update(data=open('/tmp/myimage.iso', 'rb'))
>>> print image.status
'active'
>>> image.update(properties=dict(my_custom_property='value'))
>>> with open('/tmp/copyimage.iso', 'wb') as f:
for chunk in image.data():
f.write(chunk)
>>> image.delete()
glanceclient._i18n
Moduleglanceclient.client
Moduleglanceclient.common.exceptions
Moduleglanceclient.common.http
Moduleglanceclient.common.https
Moduleglanceclient.common.progressbar
Moduleglanceclient.common.utils
Moduleglanceclient.exc
Moduleglanceclient.shell
Moduleglanceclient.v1.apiclient.base
Moduleglanceclient.v1.apiclient.exceptions
Moduleglanceclient.v1.apiclient.utils
Moduleglanceclient.v1.client
Moduleglanceclient.v1.image_members
Moduleglanceclient.v1.images
Moduleglanceclient.v1.shell
Moduleglanceclient.v1.versions
Moduleglanceclient.v2.client
Moduleglanceclient.v2.image_members
Moduleglanceclient.v2.image_schema
Moduleglanceclient.v2.image_tags
Moduleglanceclient.v2.images
Moduleglanceclient.v2.metadefs
Moduleglanceclient.v2.namespace_schema
Moduleglanceclient.v2.resource_type_schema
Moduleglanceclient.v2.schemas
Moduleglanceclient.v2.shell
Moduleglanceclient.v2.tasks
Moduleglanceclient.v2.versions
ModuleExcept where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.