25b7c094c7
Follow the Documentation Conventions: https://wiki.openstack.org/wiki/Documentation/Conventions Change-Id: I595d7154efa33df41aa532a5dfea59a1abcaa36f
1.0 KiB
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
= ksclient.Client(auth_url=env['OS_AUTH_URL'],
keystone =env['OS_USERNAME'],
username=env['OS_PASSWORD'],
password=env['OS_TENANT_NAME'],
tenant_name=env['OS_REGION_NAME'])
region_name= keystone.service_catalog.url_for(service_type='image')
glance_endpoint = glclient.Client(glance_endpoint, token=keystone.auth_token) glance