Official Python SDK for SnapRender Screenshot API
Project description
snaprender
Official Python SDK for the SnapRender Screenshot API.
Install
pip install snaprender
Quick Start
from snaprender import SnapRender
snap = SnapRender(api_key="sk_live_...")
# Capture a screenshot
image = snap.capture("https://example.com")
with open("screenshot.png", "wb") as f:
f.write(image)
# Capture with options
jpg = snap.capture(
"https://example.com",
format="jpeg",
width=1920,
height=1080,
full_page=True,
dark_mode=True,
quality=95,
)
# Check cache status
info = snap.info("https://example.com")
print(info["cached"]) # True/False
# Get usage
usage = snap.usage()
print(f"{usage['used']}/{usage['limit']} screenshots used")
Context Manager
with SnapRender(api_key="sk_live_...") as snap:
image = snap.capture("https://example.com")
Error Handling
from snaprender import SnapRender, SnapRenderError
snap = SnapRender(api_key="sk_live_...")
try:
snap.capture("https://example.com")
except SnapRenderError as e:
print(e.code) # "QUOTA_EXCEEDED"
print(e.status) # 429
print(e) # "Monthly quota exceeded"
API
SnapRender(api_key, base_url="https://app.snap-render.com", timeout=60.0)
snap.capture(url, **options) -> bytes
| Option | Type | Default | Description |
|---|---|---|---|
url |
str | — | URL to capture (required) |
format |
str | "png" |
"png", "jpeg", "webp", or "pdf" |
width |
int | 1280 |
Viewport width |
height |
int | 800 |
Viewport height |
full_page |
bool | False |
Capture full scrollable page |
quality |
int | 90 |
JPEG/WebP quality (1-100) |
delay |
int | 0 |
Wait ms after page load |
dark_mode |
bool | False |
Emulate dark mode |
block_ads |
bool | True |
Block ad networks |
block_cookie_banners |
bool | True |
Remove cookie banners |
device |
str | — | Device preset (e.g. "iPhone 15") |
cache |
bool | True |
Use cache |
cache_ttl |
int | 86400 |
Cache TTL in seconds |
snap.info(url) -> dict
snap.usage() -> dict
snap.usage_daily(days=30) -> dict
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
snaprender-0.2.0.tar.gz
(3.6 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 snaprender-0.2.0.tar.gz.
File metadata
- Download URL: snaprender-0.2.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62df5d050d739dbc08f4b19cb0042a84e087802ed4d6e3c75b9c4963cc68d1a3
|
|
| MD5 |
e3bc6c405c3b8153c5e71f1720701441
|
|
| BLAKE2b-256 |
faf774e267c09a2ad4369d8d55eeb9adb4373199ddd21c208776a1fe79a1ee00
|
File details
Details for the file snaprender-0.2.0-py3-none-any.whl.
File metadata
- Download URL: snaprender-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71c7299cd4e60c501a597c625b5a377d6e4cfd5437aa36f91b106cdc1133c762
|
|
| MD5 |
6faf3e43d8e4baef0d8e5a8c1fd1c24a
|
|
| BLAKE2b-256 |
d9bbe80e0cde887408220eec1bdd56510e9166637a9fc7ef2dc08c1f91bd4c00
|