A simple Kubernetes Python API
Project description
Kubernetes Python API
This repository contains a simple Kubernetes Python API (Kube API). This API is built using the Official Python client library (Official API) for kubernetes
Loading the Configurations
A configuration file is required for calling the APIs. There are two ways for loading configurations:
- Set the "KUBERNETES_CONFIG" environment variable to the path of the configuration file. The configurations will be loaded automatically.
- Explicitly call
config.load_configuration(config_file_path)
.
Handling Exceptions
The official API raises exceptions when there is an error. Kube API will catch the ApiException and return an error message instead. This is implemented by wrapping the function calls to the official API using the api_request()
function in utils.py
.
When there is an error calling the official API, Kube API will return a JSON response containing the body of the ApiException (which is a dictionary-like object), plus three (3) additional fields:
- status, the status returned in the ApiException
- error, the reason of the error
- headers, the header of the ApiException
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for kube_api-0.1.52-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0c16fddfe67a1c4fdef1d4299ba0dceeacead7a9beb3b1e5b1f0dc4eab9c16c |
|
MD5 | 1f71cc8104c7054aad8ef8c310659e05 |
|
BLAKE2b-256 | e963f569ef80bdc9c8a85c7b378f97c27634a2c566212fd02daddae73718f8fd |