Closed universcom closed 1 year ago
Closing as this was never answered, sorry about that. Passing an alternative below for anybody landing here in the future.
from keystoneauth1.identity import v3
from keystoneauth1 import session
from gnocchiclient.client import Client
auth = v3.Password(auth_url=os.environ.get('OS_AUTH_URL'),
project_domain_name=os.environ.get('OS_PROJECT_DOMAIN_NAME'),
user_domain_name=os.environ.get('OS_USER_DOMAIN_NAME'),
username=os.environ.get('OS_USERNAME'),
project_name=os.environ.get('OS_PROJECT_NAME'),
password=os.environ.get('OS_PASSWORD'))
sess = session.Session(auth=auth)
gnocchi = Client('1', session=sess)
This way the credentials from /etc/openstack/clouds.yml
and /etc/openstack/secure.yml
are used:
import openstack
from keystoneauth1.identity import v3
from keystoneauth1 import session
from gnocchiclient.v1 import client
# Choose cloud
os_cloud = "admin"
# Login via /etc/openstack/clouds.yml and /etc/openstack/secure.yml
conn = openstack.connect(cloud=os_cloud)
auth = v3.Password(auth_url=conn.auth["auth_url"],
project_domain_name=conn.auth["project_domain_name"],
user_domain_name=conn.auth["user_domain_name"],
username=conn.auth["username"],
project_name=conn.auth["project_name"],
password=conn.auth["password"])
sess = session.Session(auth=auth)
gnocchi = client.Client(session=sess)
# Test request
gnocchi.resource.list("generic")
hi I want use python api for openstack keystone i use auth model keystone like:
i get error:
please help me to run python api. it is very necessary for me. tanks a lot