Skip to main content

k2hr3client for python

Project description

https://img.shields.io/badge/license-MIT-blue.svg https://img.shields.io/pypi/pyversions/k2hr3client.svg https://img.shields.io/github/forks/yahoojapan/k2hr3client_python.svg https://img.shields.io/github/stars/yahoojapan/k2hr3client_python.svg https://img.shields.io/github/issues/yahoojapan/k2hr3client_python.svg https://github.com/yahoojapan/k2hr3client_python/workflows/Python%20package/badge.svg https://readthedocs.org/projects/k2hr3client-python/badge/?version=latest https://img.shields.io/pypi/v/k2hr3client

Overview

k2hr3client_python is an official Python WebAPI client for k2hr3.

https://k2hr3.antpick.ax/images/top_k2hr3.png

Install

Let’s install k2hr3client_python using pip:

pip install k2hr3client

Usage

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...

Development

Clone this repository and go into the directory, then run the following command:

$ make init
$ pipenv shell
$ make lint test docs build

Documents

Here are documents including other components.

Document top page

About K2HR3

About AntPickax

Packages

Here are packages including other components.

k2hr3client(python packages)

License

MIT License. See the LICENSE file.

AntPickax

k2hr3client_python is a project by AntPickax, which is an open source team in LY Corporation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

k2hr3client-1.0.3.tar.gz (128.0 kB view details)

Uploaded Source

Built Distribution

k2hr3client-1.0.3-py3-none-any.whl (52.5 kB view details)

Uploaded Python 3

File details

Details for the file k2hr3client-1.0.3.tar.gz.

File metadata

  • Download URL: k2hr3client-1.0.3.tar.gz
  • Upload date:
  • Size: 128.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for k2hr3client-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c2ba53d123c042f2e96f16f3fe44cf90841b8487f4eb6fdc2a7a6ec3541f5820
MD5 f86663f74381eff3b503c78f8c24ac4e
BLAKE2b-256 1a3b40f956b69a15ea32630893e5741302b23ccd53949209b1a442b79ce6dcb2

See more details on using hashes here.

File details

Details for the file k2hr3client-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: k2hr3client-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 52.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for k2hr3client-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25de92eeb61ab9bcd985ad585a988c9e0e50426f56e046e7e864a712a26c0156
MD5 9ac46ff3e95343c0350be1fa797ec9c4
BLAKE2b-256 8d9fbf93f9ac12d5577fd9b9459ccd3f404bed0d36865b1798cfbaf0f163e8b6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page