openstack-manuals/doc/user-guide/source/sdk_authenticate_against_image_service_endpoint.rst
Andreas Jaeger 28d95bfc66 End User Guide: Remove user_only and orphan
With the split of the User Guides, there's no need anymore to have
orphan and user_only flags, remove them from the user-guide
directory.

Only files that keep :orphan: are
doc/user-guide/source/hot-guide/hot_advanced_topics.rst and
hot_existing_templates.rst since these files are not currently included.

Change-Id: I1ac0356d69d8668785f8b1947e8b061731aca747
2015-05-13 18:09:16 +00:00

1.0 KiB

Authenticate against an Image Service endpoint

To authenticate against an Image Service endpoint, instantiate a glanceclient.v2.client.Client object:

from os import environ as env
import glanceclient.v2.client as glclient
import keystoneclient.v2_0.client as ksclient

keystone = ksclient.Client(auth_url=env['OS_AUTH_URL'],
                           username=env['OS_USERNAME'],
                           password=env['OS_PASSWORD'],
                           tenant_name=env['OS_TENANT_NAME'],
                           region_name=env['OS_REGION_NAME'])
glance_endpoint = keystone.service_catalog.url_for(service_type='image')
glance = glclient.Client(glance_endpoint, token=keystone.auth_token)