Official rendoc SDK for Python - PDF generation API
Project description
rendoc
Official Python SDK for the rendoc PDF generation API.
- Sync and async clients
- Full type hints
- Python 3.9+
Installation
pip install rendoc
Quick start
Sync
from rendoc import Rendoc
client = Rendoc(api_key="rnd_...")
# Generate a PDF from markup
doc = client.documents.generate(
markup="<h1>{{title}}</h1>",
data={"title": "Hello World"},
paper_size="A4",
)
print(doc.download_url)
# Generate from a template
doc = client.documents.generate(template_id="tmpl_123", data={"name": "John"})
# List templates
templates = client.templates.list()
invoices = client.templates.list(category="INVOICE")
# Check usage
usage = client.usage.get()
print(f"{usage.usage.documents}/{usage.usage.limit} documents used")
Async
import asyncio
from rendoc import AsyncRendoc
async def main():
client = AsyncRendoc(api_key="rnd_...")
doc = await client.documents.generate(
markup="<h1>Hi</h1>",
data={},
)
print(doc.download_url)
await client.close()
asyncio.run(main())
Context manager
# Sync
with Rendoc(api_key="rnd_...") as client:
doc = client.documents.generate(markup="<h1>Hi</h1>", data={})
# Async
async with AsyncRendoc(api_key="rnd_...") as client:
doc = await client.documents.generate(markup="<h1>Hi</h1>", data={})
Error handling
from rendoc import Rendoc, AuthenticationError, RateLimitError, RendocError
client = Rendoc(api_key="rnd_...")
try:
doc = client.documents.generate(markup="<h1>Hi</h1>", data={})
except AuthenticationError:
print("Invalid API key")
except RateLimitError:
print("Too many requests — slow down")
except RendocError as e:
print(f"API error: {e.message} (status {e.status_code})")
Custom base URL
client = Rendoc(api_key="rnd_...", base_url="https://custom.rendoc.dev")
Documentation
Full API reference at https://rendoc.dev/docs.
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
rendoc-1.0.0.tar.gz
(6.1 kB
view details)
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 rendoc-1.0.0.tar.gz.
File metadata
- Download URL: rendoc-1.0.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c22eecdd74ad3db174287133c8e692dde451f68185dc2ee7fe444676defe695b
|
|
| MD5 |
d0a4cad5fdeb2bce06613ec66817b7ae
|
|
| BLAKE2b-256 |
5f692e7e5b5312e4c23ecaabe7fc07bf2cd3c221a9f13849001ff9d03f81ea09
|
File details
Details for the file rendoc-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rendoc-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5e8b29de3516169de18887ed6e27ea91fbc7afd7f76b65f269d4eb2c7cbf019
|
|
| MD5 |
7f1d3a8cd5ee93022fad51fe2f46d53b
|
|
| BLAKE2b-256 |
0882d279921220faf430e2f1a69aee1f6d45e360df1585f140c479d19e52b4dd
|