If you are building monitoring dashboards, link previews, or visual QA tooling in Python, a screenshot API is a practical way to avoid browser automation overhead. This post walks through the common capture patterns Dev.to readers usually care about: basic screenshots, full-page capture, JSON output, mobile emulation, geolocation, and batch jobs.
Prerequisites
- Python 3.7+
- The
requestslibrary (pip install requests) - A Site-Shot API key (sign up here)
Basic Screenshot Capture
The simplest approach — send a GET request to the API and save the image:
import requests
response = requests.get("https://api.site-shot.com/", params={
"url": "https://example.com",
"userkey": "YOUR_API_KEY",
"width": 1280,
"height": 1024,
"format": "png",
}, timeout=70)
with open("screenshot.png", "wb") as f:
f.write(response.content)
That's it. The API renders the page in a real Chromium browser and returns the screenshot image directly.
Full Page Screenshot
To capture the entire scrollable page, not just the viewport:
response = requests.get("https://api.site-shot.com/", params={
"url": "https://example.com",
"userkey": "YOUR_API_KEY",
"full_size": 1,
"max_height": 15000,
"format": "png",
}, timeout=70)
The full_size=1 parameter tells the API to scroll through the entire document. max_height caps the capture at 15,000 pixels (max 20,000).
JSON Response with Base64 Image
If you need the image as base64 along with HTTP response metadata:
import base64
import requests
response = requests.get("https://api.site-shot.com/", params={
"url": "https://example.com",
"userkey": "YOUR_API_KEY",
"width": 1280,
"height": 1024,
"format": "png",
"response_type": "json",
}, timeout=70)
payload = response.json()
if payload.get("error"):
raise RuntimeError(payload["error"])
image_b64 = payload["image"]
if "," in image_b64:
image_b64 = image_b64.split(",", 1)[1]
with open("screenshot.png", "wb") as f:
f.write(base64.b64decode(image_b64))
The JSON response includes the image field (base64-encoded), HTTP status_code, and response_headers from the target URL.
Mobile Device Screenshot
Emulate a mobile viewport by setting width, height, and user agent:
response = requests.get("https://api.site-shot.com/", params={
"url": "https://example.com",
"userkey": "YOUR_API_KEY",
"width": 375,
"height": 812,
"zoom": 100,
"format": "png",
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) "
"AppleWebKit/605.1.15 (KHTML, like Gecko) "
"Version/16.0 Mobile/15E148 Safari/604.1",
}, timeout=70)
Screenshot from a Specific Country
Route the request through a country-specific proxy:
response = requests.get("https://api.site-shot.com/", params={
"url": "https://example.com",
"userkey": "YOUR_API_KEY",
"country": "Germany",
"language": "de",
"format": "png",
}, timeout=70)
The country parameter automatically sets a proxy IP, default language, time zone, and geolocation for that country.
Batch Screenshots
To capture multiple URLs, loop through them:
import requests
API_KEY = "YOUR_API_KEY"
urls = [
"https://example.com",
"https://wikipedia.org",
"https://github.com",
]
for url in urls:
response = requests.get("https://api.site-shot.com/", params={
"url": url,
"userkey": API_KEY,
"width": 1280,
"height": 1024,
"format": "png",
}, timeout=70)
filename = url.replace("https://", "").replace("/", "_") + ".png"
with open(filename, "wb") as f:
f.write(response.content)
print(f"Saved {filename}")
For higher throughput, use concurrent.futures.ThreadPoolExecutor to capture multiple URLs in parallel — the API supports concurrent requests based on your plan's dedicated worker count.
Summary
The Site-Shot API makes it straightforward to capture website screenshots with Python. Key parameters:
| Parameter | Description | Example |
|---|---|---|
url |
Target web page | https://example.com |
userkey |
Your API key | abc123 |
width |
Viewport width (100–8000) | 1280 |
height |
Viewport height (100–20000) | 1024 |
full_size |
Capture full page | 1 |
format |
Output format |
png or jpeg
|
response_type |
Response format |
image or json
|
country |
Proxy country | Germany |
delay_time |
Wait before capture (ms) | 2000 |
Check the full API documentation for all available parameters.
Try Site-Shot free — no registration needed: https://www.site-shot.com/
Top comments (0)