Skip to main content

Kuberlab API Client Library

Project description

# python-klabclient

## Installation

Developer installation:

```bash
git clone https://github.com/kuberlab/python-klabclient
cd python-klabclient
pip install -e .
```
* for MacOS add --ignore-installed six at the end of the command line

User installation:

```bash
pip install python-klabclient
```
* for MacOS add --ignore-installed six at the end of the command line


Install in virtual environment:


```bash
virtualenv venv
cd venv
bin/pip install python-klabclient
```

* `klab` console command will be accessed from `venv/bin/klab` path.


## Uninstall:

```bash
pip uninstall python-klabclient
```

* Also, if it is required, delete file `~/.kuberlab/config`.

## Usage

#### Use config for auth (default location is *~/.kuberlab/config*)

```bash
touch ~/.kuberlab/config
cat << EOF >> ~/.kuberlab/config
base_url: https://go.kuberlab.com/api/v0.2
token: <user-token>
EOF
```

**Note**: Refer to [Config example](config.yaml.example) to see all possible values.

#### Use environment variables

```bash
# Set token
export KUBERLAB_TOKEN=token
# Or, use your login/password
export KUBERLAB_USERNAME=my@example.com
export KUBERLAB_PASSWORD=mypassword
```

#### Call CLI or see help to take a look on a command list:

```bash
klab workspace-list

# See help
klab --help
```

## App installation example

See how to install a simple app - [App installation](App_installation.md)

**Note**: Priority for auth parameters: CLI parameters, Env variables, config values.

## Usage as a python library

```python
from klabclient.api import client

# Init session
ses = client.create_session(token='token') # Pick up default base_url
# Or, use username and password
# ses = client.create_session(username='username', password='password') # Pick up default base_url

klab = client.Client(session=ses) # Pick up default klab_url

workspaces = klab.workspaces.list()
# Print all workspace names
print([w.Name for w in workspaces])
```



Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

python_klabclient-1.0.3-py2.py3-none-any.whl (47.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python_klabclient-1.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for python_klabclient-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3417fda0bd731e45b2155cf9466d4c077c955c2ff055624e96c1415d82cb5f65
MD5 d29c9d9cf40e987069ef5d1e088db39a
BLAKE2b-256 ec6b82f5b054643d99de80a19611b17fe821bf4ea17363f9aa7436e4ff665f5e

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