Skip to main content

envbee SDK for Python

Project description

envbee Python SDK

envbee SDK is a Python client for interacting with the envbee API (see https://envbee.dev). This SDK provides methods to retrieve variables and manage caching for improved performance.

Table of Contents

Installation

To install the envbee SDK, use pip:

pip install envbee-sdk

Usage

Instantiate the Envbee class with your API credentials (either as parameters or via environment variables):

from envbee_sdk import Envbee

client = Envbee(
    api_key="your_api_key",
    api_secret=b"your_api_secret",
    enc_key=b"32-byte-encryption-key-goes-here"  # optional, could be a string or a 32 bytes buffer
)

# Retrieve a variable
value = client.get("VariableName")

# Retrieve multiple variables
variables, metadata = client.get_variables()

Environment Variables

Instead of passing credentials and configuration parameters directly when instantiating the Envbee client, you can optionally use environment variables:

  • ENVBEE_API_KEY: your API key (required if api_key is not passed explicitly)
  • ENVBEE_API_SECRET: your API secret (required if api_secret is not passed explicitly)
  • ENVBEE_ENC_KEY: optional encryption key for decrypting encrypted variables

Example using environment variables:

export ENVBEE_API_KEY="your_api_key"
export ENVBEE_API_SECRET="your_api_secret"
export ENVBEE_ENC_KEY="32-byte-encryption-key-goes-here"

Then initialize the client with no parameters:

from envbee_sdk import Envbee

client = Envbee()

value = client.get("VariableName")

Explicit parameters take precedence over environment variables if both are provided.

Methods

  • get(variable_name: str) -> any: fetch a variable value.
  • get_variables(offset: int = None, limit: int = None) -> tuple[list[dict], Metadata]: fetch multiple variable definitions with pagination.

Encryption

Some variables stored in envbee are encrypted using AES-256-GCM (via the cryptography library). Encrypted values are prefixed with envbee:enc:v1:.

  • If an encrypted variable is fetched and you provide a correct decryption key (enc_key), the SDK will decrypt it automatically.
  • If no key or a wrong key is provided, a RuntimeError will be raised on decryption.
  • The encryption key is never sent to the API; all decryption is performed locally.
  • Cached values are stored exactly as received from the API (encrypted or plain-text).

Example with encryption key:

client = Envbee(
    api_key="your_api_key",
    api_secret=b"your_api_secret",
    enc_key=b"32-byte-encryption-key-goes-here"
)

Logging

Configure logging as needed. The SDK logger name is envbee_sdk. Example:

import logging

logging.basicConfig(level=logging.ERROR)

sdk_logger = logging.getLogger("envbee_sdk")
sdk_logger.setLevel(logging.DEBUG)  # for detailed logs

# Example usage within the SDK
sdk_logger.debug("This is a debug message from the SDK.")
sdk_logger.info("Informational message from the SDK.")

Caching

The SDK caches variables locally to provide fallback data when offline or the API is unreachable. The cache is updated after each successful API call. Local cache stores variables as received from the API, encrypted or plain.

  • Encryption key is never stored in cache or sent to API.
  • All encryption/decryption happens locally with AES-256-GCM.

API Documentation

For more information on envbee API endpoints and usage, visit the official API documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

envbee_sdk-1.8.2.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envbee_sdk-1.8.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file envbee_sdk-1.8.2.tar.gz.

File metadata

  • Download URL: envbee_sdk-1.8.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for envbee_sdk-1.8.2.tar.gz
Algorithm Hash digest
SHA256 7ecdf579383bdf7cf4ea901b152786c0163d4d5f42e1810ea2d8fb2befb210bd
MD5 b2f4ae38b1ab367967f6537ebbcc8568
BLAKE2b-256 d9e9408f9908445f900381151fc3d68d8fc0182d4ce5668342f19a0b67e608e6

See more details on using hashes here.

File details

Details for the file envbee_sdk-1.8.2-py3-none-any.whl.

File metadata

  • Download URL: envbee_sdk-1.8.2-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for envbee_sdk-1.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 39ed42f17cc00271872dbbff2b55529502e843719c0352c18fae861efd09c92d
MD5 3dc469da6f2c877d1479f3022db79db8
BLAKE2b-256 1af6715b5f07bf17ebadb32078dd8d06b4478c75723b6d78fe643d97a31d5c9c

See more details on using hashes here.

Supported by

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