k2hr3client_python is an official Python WebAPI client for k2hr3.
Let's install k2hr3client_python using pip:
pip install k2hr3client
Let's try to get a token and create a resource.:
>>> from k2hr3client.token import K2hr3Token >>> iaas_user = "demo" >>> iaas_project = "demo" >>> iaas_token_url = "http://172.24.4.1/identity/v3/auth/tokens" >>> iaas_token = K2hr3Token.get_openstack_token( ... iaas_token_url, iaas_user, "password", iaas_project ... ) >>> mytoken = K2hr3Token(iaas_project, iaas_token) >>> >>> from k2hr3client.http import K2hr3Http >>> k2hr3_token_url = "http://127.0.0.1:18080" >>> myhttp = K2hr3Http(k2hr3_token_url) >>> myhttp.POST(mytoken.create()) >>> mytoken.token // k2hr3 token >>> >>> from k2hr3client.resource import K2hr3Resource >>> k2hr3_resource_name = "test_resource" >>> myresource = K2hr3Resource(mytoken.token) >>> myhttp.POST( ... myresource.create_conf_resource( ... name=k2hr3_resource_name, ... data_type="string", ... data="testresourcedata", ... tenant="demo", ... cluster_name="testcluster", ... keys={ ... "cluster-name": "test-cluster", ... "chmpx-server-port": "8020", ... "chmpx-server-ctrlport": "8021", ... "chmpx-slave-ctrlport": "8031"}, ... alias=[]) ... ) >>> myresource.resp.body // {"result":true...
Clone this repository and go into the directory, then run the following command:
$ make init $ pipenv shell $ make lint test docs build
Here are documents including other components.
Here are packages including other components.
MIT License. See the LICENSE file.
k2hr3client_python is a project by AntPickax, which is an open source team in LY Corporation.