From ef9b654c1de1dca83a2a38c013965da76665149f Mon Sep 17 00:00:00 2001 From: cindy oneill Date: Wed, 27 May 2015 14:01:23 -0600 Subject: [PATCH] Fixed README for Python API - about re-athenticate Change-Id: I7a200084075d0358e9619401fe8aa61a024fcbd5 --- README.rst | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 7c283cc..1230a5d 100644 --- a/README.rst +++ b/README.rst @@ -335,9 +335,10 @@ Python API There's also a complete Python API. -In order to use the python api directly, you must first obtain an auth token and -identify the monasca api endpoint. The user can obtain the token and endpoint -using the keystone client api: +In order to use the python api directly, you must pass in a valid auth token and +monasca api endpoint, or you can pass in the credentials required by the keystone +client and let the Python API do the authentication. The user can obtain the token +and endpoint using the keystone client api: http://docs.openstack.org/developer/python-keystoneclient/. The service catalog name for our API endpoint is "monasca". @@ -346,18 +347,21 @@ The Client class takes these parameters: api_version, endpoint, and token. The Client class is used to call all monasca-api resource commands (i.e. client.Client.metrics.create(fields)). -Long running users of Client will recieve an indication +Long running users of the Client will recieve an indication that the keystone token has expired when they receive an HTTP response code of 401 Unauthorized from the monasca-API. In this case, it is up to the user to get a new token from keystone which can be passed -into the client.Client.replace_token(token) method. +into the client.Client.replace_token(token) method. If you constructed +the Client with all the keystone credentials needed to authenticate, +then the API will automatically try one time to re-authenticate with +keystone whenever the token expires. The api_version matches the version of the Monasca API. Currently it is 'v2_0'. When calling the commands, refer to monascaclient.v2_0.shell.py 'do_' to see the required and optional fields for each command. -Refer to this example in python-monascaclient/client_api_example.py:: +Refer to the example in python-monascaclient/client_api_example.py for more detail:: from monascaclient import client from monascaclient import ksclient