Production-grade SDK for DevUtils API - Screenshot, PDF, Reader, and more
Project description
DevUtils SDK - Python
Production-grade Python SDK for DevUtils API. Take screenshots, generate PDFs, read content, and more.
Installation
pip install devutils-sdk
Quick Start
import asyncio
from devutils_sdk import DevUtilsSDK, ScreenshotOptions
async def main():
sdk = DevUtilsSDK(api_key="your-api-key")
# Take a screenshot
result = await sdk.screenshot(
ScreenshotOptions(
url="https://example.com",
format="png",
width=1280,
height=720
)
)
print(f"Screenshot job: {result.job_id}")
print(f"Status: {result.status}")
sdk.close()
asyncio.run(main())
Features
- 📸 Screenshots - Capture web pages as images
- 📄 PDF Generation - Convert web pages to PDF
- 📖 Content Reader - Extract and parse web content
- 🔄 Async/Await - Full async support
- ⚡ Retry Logic - Automatic retry with exponential backoff
- 🔐 Type Safe - Full type hints and validation
- 📦 Lightweight - Minimal dependencies
API Reference
Screenshot
from devutils_sdk import ScreenshotOptions
result = await sdk.screenshot(
ScreenshotOptions(
url="https://example.com",
format="png", # png, jpeg, webp
width=1280,
height=720,
full_page=False,
wait_until="networkidle",
timeout=30000
)
)
from devutils_sdk import PDFOptions
result = await sdk.pdf(
PDFOptions(
url="https://example.com",
format="A4",
margin_top="1cm",
margin_right="1cm",
margin_bottom="1cm",
margin_left="1cm",
print_background=True,
landscape=False
)
)
Reader
result = await sdk.reader("https://example.com")
print(result.title)
print(result.content)
Error Handling
from devutils_sdk import DevUtilsError
try:
result = await sdk.screenshot(options)
except DevUtilsError as e:
print(f"Error: {e.code} - {e.message}")
if e.is_retryable():
print("This error can be retried")
Configuration
from devutils_sdk import DevUtilsSDK, HttpClientConfig
config = HttpClientConfig(
base_url="https://api.devutils.in",
timeout=30,
max_retries=3,
api_key="your-api-key"
)
sdk = DevUtilsSDK(api_key="your-api-key", config=config)
Requirements
- Python 3.8+
- requests >= 2.28.0
- pydantic >= 2.0.0
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=devutils_sdk
# Format code
black devutils_sdk
# Lint
flake8 devutils_sdk
# Type check
mypy devutils_sdk
License
MIT
Support
- Documentation: https://docs.devutils.in
- Issues: https://github.com/devutils/sdk-python/issues
- Email: support@devutils.in
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
devutils_sdk-1.0.3.tar.gz
(13.2 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 devutils_sdk-1.0.3.tar.gz.
File metadata
- Download URL: devutils_sdk-1.0.3.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
597509fe72831d6dff6dc26a37ed1a1009abc393b85a34eddccef86f3a7c66db
|
|
| MD5 |
d1b0c3dae724fdd88fb492a6976dee02
|
|
| BLAKE2b-256 |
1a07c0edec095fb07fcfd44232a321ad20c659b8f838e841c85a8c28a42e4848
|
File details
Details for the file devutils_sdk-1.0.3-py3-none-any.whl.
File metadata
- Download URL: devutils_sdk-1.0.3-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a1944c79affb05c41be2b53c0d1cd11d48c5efd8f7d25c2fc70c7cb354d4e1d
|
|
| MD5 |
5f6797b33b5fc1eca95badb4c03b8347
|
|
| BLAKE2b-256 |
d5c5a3575b80d1da81821bf949db1559c9b9892a7f2272f23d2e9a398872d541
|