Python SDK
Official SDK for the ScreenshotCenter API. Capture screenshots, PDFs, HTML, and video — without writing raw HTTP calls.
Installation
terminal
pip install screenshotcenter
Package coming soon to PyPI — pypi.org/project/screenshotcenter
Quick start
main.py
from screenshotcenter import ScreenshotCenterClient
client = ScreenshotCenterClient(api_key="your_api_key")
shot = client.screenshot.create(url="https://example.com", country="us")
result = client.wait_for(shot["id"])
print(result["status"]) # finished
client.screenshot.save_image(result["id"], "homepage.png") More examples
Geo-targeting
# Capture from France
shot = client.screenshot.create(
url="https://example.com",
country="fr",
language="fr-FR",
timezone="Europe/Paris",
)
result = client.wait_for(shot["id"])
client.screenshot.save_image(result["id"], "fr.png") PDF generation
shot = client.screenshot.create(url="https://example.com", pdf=True)
result = client.wait_for(shot["id"])
assert result["has_pdf"] is True
client.screenshot.save_pdf(result["id"], "page.pdf") Error handling
from screenshotcenter import ApiError, ScreenshotFailedError, TimeoutError
try:
shot = client.screenshot.create(url="https://example.com")
result = client.wait_for(shot["id"], timeout=60)
except ScreenshotFailedError as e:
print(f"Screenshot {e.screenshot_id} failed: {e.error}")
except TimeoutError as e:
print(f"Timed out after {e.timeout_ms}ms")
except ApiError as e:
print(f"API error {e.status}: {e}")