Skip to main content

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
    )
)

PDF

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

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

devutils_sdk-1.0.2.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

devutils_sdk-1.0.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file devutils_sdk-1.0.2.tar.gz.

File metadata

  • Download URL: devutils_sdk-1.0.2.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for devutils_sdk-1.0.2.tar.gz
Algorithm Hash digest
SHA256 44647e28974af68449f417b0d0540d97b8705f084a3fab36d58ad920aab2a081
MD5 cab2fab05a847d733b3caf6a7aece9f0
BLAKE2b-256 7fc782f986aa5b6c8e34f81e261df97cf77e7ae0a0fc427b98c28433e05054d4

See more details on using hashes here.

File details

Details for the file devutils_sdk-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: devutils_sdk-1.0.2-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

Hashes for devutils_sdk-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2ce91222c54638dcec7245edc8c50c6211bdf9817ab28cf0ecd70439bd179f12
MD5 bc384c5ef31aa0f2fe32c4647489e0e8
BLAKE2b-256 910d103770ef33dbc2d609991d8590a66c4dcaf4743773470debdde4f5df7ad8

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