From ae8f46ed483857edc7cbe25113130530fc509353 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Tue, 22 Jul 2014 16:10:41 -0400 Subject: [PATCH] Add an example of using v3 client with sessions Added a bit more information to the 'using-api-v3' section, about using sessions instead of passing in arguments. This overlaps with what is documented in 'using-sessions' but I think it's still handy as most folks will likely go here first. Change-Id: I352bda49e01362d3a5da9a79ceb34748552ef9ec --- doc/source/using-api-v3.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/source/using-api-v3.rst b/doc/source/using-api-v3.rst index 814f16f2e..13274462f 100644 --- a/doc/source/using-api-v3.rst +++ b/doc/source/using-api-v3.rst @@ -111,3 +111,23 @@ domain name), to obtain a scoped token:: ... user_domain_name=user_domain_name, ... project_name=project_name, ... project_domain_name=project_domain_name) + +Using Sessions +============== + +It's also possible to instantiate a :py:class:`keystoneclient.v3.client.Client` +class by using :py:class:`keystoneclient.session.Session`.:: + + >>> from keystoneclient.auth.identity import v3 + >>> from keystoneclient import session + >>> from keystoneclient.v3 import client + >>> auth = v3.Password(auth_url='https://my.keystone.com:5000/v3', + ... user_id='myuserid', + ... password='mypassword', + ... project_id='myprojectid') + >>> sess = session.Session(auth=auth) + >>> keystone = client.Client(session=sess) + +For more information on Sessions refer to: `Using Sessions`_. + +.. _`Using Sessions`: using-sessions.html