Capture website screenshots in Python without installing Selenium, Chrome drivers, or Playwright. One HTTP request with the requests library is all you need.
import requests
url = "https://grabshot.dev/v1/screenshot"
params = {
"url": "https://example.com",
"key": "YOUR_API_KEY"
}
response = requests.get(url, params=params)
with open("screenshot.png", "wb") as f:
f.write(response.content)
import requests
import os
def capture_screenshot(target_url, **options):
"""Capture a website screenshot using GrabShot API."""
params = {
"url": target_url,
"key": os.environ["GRABSHOT_API_KEY"],
"width": options.get("width", 1440),
"height": options.get("height", 900),
"format": options.get("format", "png"),
"fullPage": options.get("full_page", "false"),
}
if options.get("dark_mode"):
params["darkMode"] = "true"
if options.get("device_frame"):
params["deviceFrame"] = options["device_frame"]
response = requests.get("https://grabshot.dev/v1/screenshot", params=params)
response.raise_for_status()
return response.content
# Usage
img = capture_screenshot(
"https://github.com",
width=1920,
full_page=True,
device_frame="macbook"
)
with open("github.png", "wb") as f:
f.write(img)
# views.py
from django.http import HttpResponse
import requests
def screenshot_view(request):
url = request.GET.get("url")
if not url:
return HttpResponse("url parameter required", status=400)
resp = requests.get("https://grabshot.dev/v1/screenshot", params={
"url": url,
"key": settings.GRABSHOT_API_KEY,
})
return HttpResponse(resp.content, content_type="image/png")
from flask import Flask, request, send_file
import requests as http
from io import BytesIO
app = Flask(__name__)
@app.route("/screenshot")
def screenshot():
url = request.args.get("url")
resp = http.get("https://grabshot.dev/v1/screenshot", params={
"url": url,
"key": app.config["GRABSHOT_KEY"],
})
return send_file(BytesIO(resp.content), mimetype="image/png")
| Feature | GrabShot API | Selenium | Playwright |
|---|---|---|---|
| Setup | pip install requests | Chrome + chromedriver | playwright install |
| Memory | ~0 MB | 300-800 MB | 200-500 MB |
| Speed | ~2s API call | 5-15s per page | 3-10s per page |
| Concurrency | Unlimited | RAM-limited | RAM-limited |
| Server needed | No | Yes (display) | Yes (or headless) |
| Device frames | Built-in | Manual | Emulation only |
Capture visual snapshots alongside your scraped data for verification and archival.
Generate PDF reports with embedded website screenshots using ReportLab or WeasyPrint.
Create social media cards with website previews for your marketing pipeline.
Periodically capture screenshots of web dashboards for stakeholder updates.
Free tier: 25 screenshots/month. No credit card required.
Starter: $9/mo for 2,500 screenshots, no watermark.
Pro: $29/mo for 10,000 screenshots with AI cleanup.
Start Free — No Credit Card →