Screenshot Scout Python SDK
The official Python SDK for the Screenshot Scout screenshot API. Easily capture website screenshots from your Python applications.
Requirements
Python 3.11 or newer.
Installation
python -m pip install screenshotscout
Get your API credentials
Before using the SDK, sign up for Screenshot Scout or sign in to your existing account. Screenshot Scout automatically creates a default API key when you sign up.
Open the API Keys page and copy the access key. You only need the secret key for signed requests.
Set the access key as the SCREENSHOTSCOUT_ACCESS_KEY environment variable, or
pass it in code.
Capture a screenshot
Create a client and call capture() with the URL you want to screenshot:
from pathlib import Path
from screenshotscout import (
BinaryCaptureResponse,
CaptureFormat,
CaptureOptions,
ScreenshotScoutClient,
)
with ScreenshotScoutClient() as client: # Reads SCREENSHOTSCOUT_ACCESS_KEY
response = client.capture(
"https://example.com",
CaptureOptions(format=CaptureFormat.WEBP, full_page=True),
)
if not isinstance(response, BinaryCaptureResponse):
raise RuntimeError("Expected a binary capture response")
Path("screenshot.webp").write_bytes(response.bytes)
POST is used by default, or GET when the client has a secret key. The screenshot is available as
response.bytes.
Request a JSON result
Set response_type to CaptureResponseType.JSON to receive screenshot metadata instead of the
binary file:
from screenshotscout import (
CaptureOptions,
CaptureResponseType,
JsonCaptureResponse,
ScreenshotScoutClient,
)
options = CaptureOptions(response_type=CaptureResponseType.JSON)
with ScreenshotScoutClient() as client: # Reads SCREENSHOTSCOUT_ACCESS_KEY
response = client.capture("https://example.com", options)
if not isinstance(response, JsonCaptureResponse):
raise RuntimeError("Expected a JSON capture response")
print(response.result.screenshot_url)
Async client
Use AsyncScreenshotScoutClient in applications that use asyncio. await capture() waits for
and returns the completed capture; it does not create a background job.
import asyncio
from screenshotscout import AsyncScreenshotScoutClient, BinaryCaptureResponse, CaptureOptions
async def main() -> None:
async with AsyncScreenshotScoutClient() as client: # Reads SCREENSHOTSCOUT_ACCESS_KEY
response = await client.capture(
"https://example.com",
CaptureOptions(full_page=True),
)
if isinstance(response, BinaryCaptureResponse):
print(len(response.bytes))
asyncio.run(main())
Use GET
POST is the default, or GET when the client has a secret key. Pass CaptureHTTPMethod.GET when
you need a GET request:
from screenshotscout import CaptureHTTPMethod
response = client.capture(
"https://example.com",
method=CaptureHTTPMethod.GET,
)
Build a capture URL
Use build_capture_url() when a browser, an HTML <img> element, or another application needs to
load the screenshot directly. Building the URL does not make a request.
from screenshotscout import CaptureOptions
capture_url = client.build_capture_url(
"https://example.com",
CaptureOptions(full_page=True, block_ads=True),
)
The generated URL contains your access key. If the client has a secret key, the URL is signed automatically; otherwise, it is unsigned. Treat generated URLs as sensitive. Before exposing one to a browser or user, add your secret key to the client and enable Require signed requests on the API Keys page.
Signed requests
Set the API key's secret key as the SCREENSHOTSCOUT_SECRET_KEY environment variable. The client
then signs its capture requests and the capture URLs it builds, with no change to your code:
from screenshotscout import ScreenshotScoutClient
# Reads SCREENSHOTSCOUT_ACCESS_KEY and SCREENSHOTSCOUT_SECRET_KEY
with ScreenshotScoutClient() as client:
response = client.capture("https://example.com")
The secret key is used locally and is never transmitted. See the signed requests guide for details.
Pass the keys yourself
To use keys from somewhere other than the environment, such as a secrets manager or per-customer settings, pass them to the client:
from screenshotscout import ScreenshotScoutClient
with ScreenshotScoutClient(
config.access_key,
secret_key=config.secret_key, # optional
) as client:
response = client.capture("https://example.com")
If you pass either key, the client reads neither environment variable. If you pass no key, for
example because the variable holding it is None, the client reads both environment variables
instead.
Send requests to another server
To send requests to another server, such as your own proxy or a mock server, pass its base URL, or
set it as the SCREENSHOTSCOUT_BASE_URL environment variable:
from screenshotscout import ScreenshotScoutClient
# Reads SCREENSHOTSCOUT_ACCESS_KEY
with ScreenshotScoutClient(base_url="https://proxy.example.com") as client:
response = client.capture("https://example.com")
The client sends captures to the base URL plus /v1/capture, and build_capture_url() builds URLs
on it. A base URL you pass wins over the variable.
Capture options
The target URL is the first argument to capture(). Use CaptureOptions keyword arguments to
customize the screenshot:
| Area | CaptureOptions fields |
|---|---|
| Output | format, response_type |
| Network and location | country, proxy, geolocation_latitude, geolocation_longitude, geolocation_accuracy |
| Cookies and headers | cookies, headers |
| Navigation and timing | timeout, wait_until, navigation_timeout, delay |
| Device emulation | device, device_viewport_width, device_viewport_height, device_scale_factor, device_is_mobile, device_has_touch, device_user_agent |
| Page preferences | timezone, media_type, color_scheme, reduced_motion |
| Full page | full_page, full_page_pre_scroll, full_page_pre_scroll_step, full_page_pre_scroll_step_delay, full_page_max_height |
| Blocking | block_cookie_banners, block_ads, block_chat_widgets |
| Interactions and injection | hide_selectors, click_selectors, click_all_selectors, inject_css, inject_js, bypass_csp |
| Selection and clipping | selector, clip_x, clip_y, clip_width, clip_height |
| Image output | image_width, image_height, image_mode, image_anchor, image_allow_upscale, image_background, image_quality |
| PDF output | pdf_paper_format, pdf_landscape, pdf_print_background, pdf_margin, pdf_margin_top, pdf_margin_right, pdf_margin_bottom, pdf_margin_left, pdf_scale, pdf_page_ranges |
| Caching | cache, cache_ttl, cache_key |
| Storage | storage_mode, storage_endpoint, storage_bucket, storage_region, storage_object_key |
Use the provided constants for autocomplete, or pass a string:
from screenshotscout import CaptureFormat, CaptureOptions, CaptureWaitUntil
options = CaptureOptions(
format=CaptureFormat.WEBP,
wait_until=CaptureWaitUntil.LOAD,
)
response = client.capture("https://example.com", options)
See the screenshot option reference for available values and examples.
Timeouts
from screenshotscout import CaptureOptions, ScreenshotScoutClient
with ScreenshotScoutClient() as client: # Reads SCREENSHOTSCOUT_ACCESS_KEY
response = client.capture(
"https://example.com",
CaptureOptions(timeout=180),
)
CaptureOptions.timeout controls how long Screenshot Scout may spend capturing the page.
If your application needs network timeouts, configure them on an injected httpx.Client or
httpx.AsyncClient; async callers can also set a total deadline with asyncio.timeout().
Responses
BinaryCaptureResponseprovides the screenshot asbytes, along with URL, expiry, and cache information when available. For Markdown or HTML, it also provides the text asmarkdownorhtml.JsonCaptureResponseprovides screenshot metadata inresult.
Both response types include raw_response for access to the HTTP status, headers, content type,
and body.
Error handling
from screenshotscout import (
ScreenshotScoutAPIError,
ScreenshotScoutClient,
ScreenshotScoutError,
ScreenshotScoutTransportError,
)
try:
with ScreenshotScoutClient() as client: # Reads SCREENSHOTSCOUT_ACCESS_KEY
response = client.capture("https://example.com")
except ScreenshotScoutAPIError as error:
print(error.status, error.error_code, error.error_message)
except ScreenshotScoutTransportError as error:
print(error.cause)
except ScreenshotScoutError as error:
print(error)
The SDK does not automatically retry failed requests.
Examples
Runnable programs are available in examples:
Development
Create a virtual environment and install the package with its development tools:
python -m venv .venv
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
Run the local checks:
python -m ruff format --check .
python -m ruff check .
python -m mypy
python -m pytest
python -m build
License
This project is licensed under the MIT License. See LICENSE.
Metadata
Release files for screenshotscout 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| screenshotscout-0.8.0.tar.gz | 26.7 kB | With provenance | Details for screenshotscout-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| screenshotscout-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for screenshotscout-0.8.0-py3-none-any.whl |
Total release size: 44.1 kB
Release files / screenshotscout-0.8.0.tar.gz
| Download URL | screenshotscout-0.8.0.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbb81dc1ab452d4900a9d61810b36fe72fe40f004d8736b4bf6bb41944e85a6b
|
|
BLAKE2b-256 checksum How to use checksums |
b92d03fb88c833f88f2b8553da2e538308c8cae648aa87a4cd1d7cebe1131e55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / screenshotscout-0.8.0-py3-none-any.whl
| Download URL | screenshotscout-0.8.0-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
541166c0f7bf04311b3d66b35f53a607f87ce6163c9580274324574f08cba665
|
|
BLAKE2b-256 checksum How to use checksums |
43fcc4ab263ef460baf9642ff3b62f56f42581e85bed164bf162b4f2137e579a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logSecurity for screenshotscout 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for screenshotscout-0.8.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.