Skip to main content

Library for interacting with Clerk

Project description

CLERK

clerk-sdk is a Python library designed to simplify interactions with the Clerk API. It provides a robust and user-friendly interface for managing documents, handling API requests, and integrating structured data models into your workflows. clerk-sdk is ideal for developers looking to streamline their integration with Clerk.

Features

  • Document Management: Retrieve and manage documents and their associated files.
  • API Request Handling: Simplified GET and POST requests with automatic retries and error handling.
  • Data Models: Predefined Pydantic models for structured data validation and serialization.
  • Task Flow Integration: Decorator for creating and managing task flows.
  • Extensibility: Easily extend and customize the library to fit your specific use case.

Installation

Install the library using pip:

pip install clerk-sdk

Usage

Initialize the Client

from clerk import Clerk

clerk_client = Clerk(api_key="your_api_key")

Retrieve a Document

document = clerk_client.get_document(document_id="12345")
print(document.title)

Retrieve Files Associated with a Document

files = clerk_client.get_files_document(document_id="12345")
for file in files:
    print(file.name)

Use the Task Decorator

PROD

from clerk.decorator import clerk_code
from clerk.decorator.models import ClerkCodePayload

@clerk_code()
def main(payload: ClerkCodePayload) -> ClerkCodePayload:
    payload.structured_data["status"] = "ok"
    return payload

main()

TEST

from clerk.decorator.models import ClerkCodePayload, Document

def test_main():
    test_payload = ClerkCodePayload(
        document=Document(id="doc-123", message_subject="Hello"),
        structured_data={}
    )

    result = main(test_payload)  # ✅ Just pass it!
    assert result.structured_data["status"] == "ok"

Requirements

  • Python 3.10+
  • Dependencies listed in requirements.txt:
    • pydantic>2.0.0
    • backoff>2.0.0

License

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

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.

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

clerk_sdk-0.2.7.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

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

clerk_sdk-0.2.7-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

Details for the file clerk_sdk-0.2.7.tar.gz.

File metadata

  • Download URL: clerk_sdk-0.2.7.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for clerk_sdk-0.2.7.tar.gz
Algorithm Hash digest
SHA256 0a6fc7947bdc37a4809d2f1f7545cf5769728cd6435ab2b38609ddcb734eea17
MD5 c9966b2ba2e810ac97975fec1a4d5b2d
BLAKE2b-256 fcb4a72f52fa38cd33eff2f5095d6852a883d8de60416c59a0feec4b5032be37

See more details on using hashes here.

File details

Details for the file clerk_sdk-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: clerk_sdk-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for clerk_sdk-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3b2b0cf310f32d0177f145801e55e0cb8b3b1385d7781a2ddef6b465f132e1c7
MD5 26bfddbc0b399d2e0906d89d9c5fcb1e
BLAKE2b-256 aedb3fd9e5cb0265d5db9007f966c70ec8c1695526c6d8a79eddac0d321ef4ca

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