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.0backoff>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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clerk_sdk-0.3.3.tar.gz.
File metadata
- Download URL: clerk_sdk-0.3.3.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
228ee1ae5e4aecbc627068987ebd8e47701044ff9a5de36d23d84a17cacc7f25
|
|
| MD5 |
214e12385fc820328773dcdc368291ff
|
|
| BLAKE2b-256 |
fdfd8e9a93b2a558d3a4dc13592c96e58ffdf887fd874830a7b476502e635040
|
File details
Details for the file clerk_sdk-0.3.3-py3-none-any.whl.
File metadata
- Download URL: clerk_sdk-0.3.3-py3-none-any.whl
- Upload date:
- Size: 48.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7657c9316d345f6e35225f2176e55e1db7848a0b2a753912bf4856ebff0ec400
|
|
| MD5 |
b0a235242efb4c2b5b36b33426bc5b2b
|
|
| BLAKE2b-256 |
09618454b87ffbdd5ed9d9cd7aa4c5ff41fbe875138e867cfbe5eb18914527af
|