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.1.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.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: envbee_sdk-1.8.1.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.1.tar.gz
Algorithm Hash digest
SHA256 dff1f83990987e5bc487c04ead9e52ddfd21ac39b44f23325a75c04ecdc0d9e4
MD5 223693d7d454e5f05086c700e4d233bb
BLAKE2b-256 a849e73b592fa569024bdd87a4b0afe7d485977453a433acf0a27f36e7218f50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: envbee_sdk-1.8.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7961d2f7baf2d68a348ea8a49e93db1987649049b898d40b3ad67780f86fee2f
MD5 21b96c0a3bbdcce74e979d5eefb59300
BLAKE2b-256 59e3ca305ab67103f19e0d8b4e5f121969a566dfb6645cb4cb4261c187137d0f

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