diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-02-02 18:04:18 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-02-02 18:04:18 +0000 |
commit | ddbd92518c84d51a62c685c5d6ad8ac7e7e481b9 (patch) | |
tree | 25b79b86cb69c737f3f3706d1e69ea44af364ba8 | |
parent | e458873b92358ba0a6e594287271bc36675c2aab (diff) | |
parent | 3568acb61732d1ce090b41e2c991307a257070db (diff) | |
download | python-keystoneclient-ddbd92518c84d51a62c685c5d6ad8ac7e7e481b9.tar.gz |
Merge "Docstring usability improvements"
-rw-r--r-- | keystoneclient/__init__.py | 12 | ||||
-rw-r--r-- | keystoneclient/client.py | 14 |
2 files changed, 18 insertions, 8 deletions
diff --git a/keystoneclient/__init__.py b/keystoneclient/__init__.py index a3c0408..08545c5 100644 --- a/keystoneclient/__init__.py +++ b/keystoneclient/__init__.py @@ -15,9 +15,15 @@ """The python bindings for the OpenStack Identity (Keystone) project. -See :py:class:`keystoneclient.v3.client.Client` for the Identity V3 client. - -See :py:class:`keystoneclient.v2_0.client.Client` for the Identity V2.0 client. +A Client object will allow you to communicate with the Identity server. The +recommended way to get a Client object is to use +:py:func:`keystoneclient.client.Client()`. :py:func:`~.Client()` uses version +discovery to create a V3 or V2 client depending on what versions the Identity +server supports and what version is requested. + +Identity V2 and V3 clients can also be created directly. See +:py:class:`keystoneclient.v3.client.Client` for the V3 client and +:py:class:`keystoneclient.v2_0.client.Client` for the V2 client. """ diff --git a/keystoneclient/client.py b/keystoneclient/client.py index 8de2963..f4b9f87 100644 --- a/keystoneclient/client.py +++ b/keystoneclient/client.py @@ -22,11 +22,15 @@ HTTPClient = httpclient.HTTPClient def Client(version=None, unstable=False, session=None, **kwargs): """Factory function to create a new identity service client. + The returned client will be either a V3 or V2 client. Check the version + using the :py:attr:`~keystoneclient.v3.client.Client.version` property or + the instance's class (with instanceof). + :param tuple version: The required version of the identity API. If specified the client will be selected such that the major version is equivalent and an endpoint provides at least the specified minor version. For example to - specify the 3.1 API use (3, 1). + specify the 3.1 API use ``(3, 1)``. :param bool unstable: Accept endpoints not marked as 'stable'. (optional) :param session: A session object to be used for communication. If one is not provided it will be constructed from the provided @@ -34,11 +38,11 @@ def Client(version=None, unstable=False, session=None, **kwargs): :type session: keystoneclient.session.Session :param kwargs: Additional arguments are passed through to the client that is being created. - :returns: New keystone client object - (keystoneclient.v2_0.Client or keystoneclient.v3.Client). - + :returns: New keystone client object. + :rtype: :py:class:`keystoneclient.v3.client.Client` or + :py:class:`keystoneclient.v2_0.client.Client` :raises keystoneclient.exceptions.DiscoveryFailure: if the server's - response is invalid + response is invalid. :raises keystoneclient.exceptions.VersionNotAvailable: if a suitable client cannot be found. """ |