Fixed README for Python API - about re-athenticate
Change-Id: I7a200084075d0358e9619401fe8aa61a024fcbd5
This commit is contained in:
parent
d2e9882838
commit
ef9b654c1d
16
README.rst
16
README.rst
|
@ -335,9 +335,10 @@ Python API
|
||||||
|
|
||||||
There's also a complete 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
|
In order to use the python api directly, you must pass in a valid auth token and
|
||||||
identify the monasca api endpoint. The user can obtain the token and endpoint
|
monasca api endpoint, or you can pass in the credentials required by the keystone
|
||||||
using the keystone client api:
|
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/.
|
http://docs.openstack.org/developer/python-keystoneclient/.
|
||||||
The service catalog name for our API endpoint is "monasca".
|
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.
|
The Client class is used to call all monasca-api resource commands (i.e.
|
||||||
client.Client.metrics.create(fields)).
|
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
|
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
|
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
|
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'.
|
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_<command>'
|
When calling the commands, refer to monascaclient.v2_0.shell.py 'do_<command>'
|
||||||
to see the required and optional fields for each command.
|
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 client
|
||||||
from monascaclient import ksclient
|
from monascaclient import ksclient
|
||||||
|
|
Loading…
Reference in New Issue