Skip to main content

Lockbox Python SDK

Static Badge

Python SDK for the Lockbox API.

Installation

pip install lockbox-sdk

Usage

import asyncio

from lockbox_sdk import AsyncLockboxSdk
from lockbox_sdk.v1.api_keys.dto import CreateApiKeyRequestDTO, IntrospectApiKeyRequestDTO


API_URL = "http://localhost:8087"

async def main():
    async with AsyncLockboxSdk(API_URL) as sdk:
        # Namespaces API
        namespaces = await sdk.v1.namespaces.find_namespaces(
            page=1,
            per_page=10,
            names=["namespace1", "namespace2"],
            tenant_id="my-tenant",
        )
        print(namespaces)

        namespace = await sdk.v1.namespaces.get_namespace(
            name="namespace3",
            tenant_id="my-tenant",
        )
        print(namespace)

        await sdk.v1.namespaces.delete_namespace(
            name="namespace2",
            tenant_id="my-tenant",
        )

        # Tags API
        tags = await sdk.v1.tags.find_tags(
            namespace="namespace2",
            page=1,
            per_page=10,
            names=["tag1", "tag2"],
            tenant_id="my-tenant",
        )
        print(tags)

        tag = await sdk.v1.tags.get_tag(
            namespace="namespace2",
            name="tag1",
            tenant_id="my-tenant",
        )
        print(tag)

        # API keys API
        api_key = await sdk.v1.api_keys.create_api_key(
            payload=CreateApiKeyRequestDTO(
                owner="user@example.com",
                scope="read:documents edit:posts",
                tag=tag.name,
                metadata={
                    "special": "sauce",
                }
            ),
            tenant_id="my-tenant"
        )
        print(api_key)

        introspection = await sdk.v1.api_keys.introspect_api_key(
            payload=IntrospectApiKeyRequestDTO(
                token=api_key.key,
                scope="read:documents",
                tag=tag.name,
            ),
            tenant_id="my-tenant"
        )
        print(introspection)

        new_api_key = await sdk.v1.api_keys.rotate_api_key(
            id=api_key.id,
            tenant_id="my-tenant"
        )
        print(new_api_key)

This library provides both an asynchronous and synchronous client. Simply use the LockboxSdk class for synchronous operations.

License

This project is licensed under MIT License.

Support & Feedback

If you encounter any issues or have feedback, please open an issue. We'd love to hear from you!

Made with ❤️ by Emergent Methods

Metadata

Release files for lockbox-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for lockbox-sdk 0.1.2
File Interpreter ABI Platform Actions
lockbox_sdk-0.1.2-py3-none-any.whl Python 3 none any Details for lockbox_sdk-0.1.2-py3-none-any.whl

Release files / lockbox_sdk-0.1.2-py3-none-any.whl

Download URL lockbox_sdk-0.1.2-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9178d24e6734e9aad0a3bc2019b1072353c07f22e0782a65cd49672c6646669f
BLAKE2b-256 checksum
How to use checksums
6184e282b6b5683eb8c9065060cf0f59d52b66c9ec9dbc068f585e30064e0887
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.14

Security for lockbox-sdk 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page