Skip to main content

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:

  1. Set the "KUBERNETES_CONFIG" environment variable to the path of the configuration file. The configurations will be loaded automatically.
  2. 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


Download files

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

Source Distribution

kube_api-0.1.51.tar.gz (12.3 kB view hashes)

Uploaded Source

Built Distribution

kube_api-0.1.51-py3-none-any.whl (13.8 kB view hashes)

Uploaded Python 3

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