Python SDK for the SnapAPI web intelligence API — screenshots, metadata, PDF, page analysis
Project description
snapapi-python
Python SDK for the SnapAPI web intelligence API. Zero dependencies — uses only the Python standard library.
pip install snapapi-python
Quick Start
from snapapi import SnapAPI
client = SnapAPI() # reads SNAPAPI_KEY from environment
# Screenshot
png = client.screenshot("https://github.com", full_page=True)
open("screenshot.png", "wb").write(png)
# Metadata
meta = client.metadata("https://github.com")
print(meta["og_title"]) # "GitHub: Let's build from here"
print(meta["og_image"]) # "https://..."
# Full page analysis
data = client.analyze("https://stripe.com")
print(data["page_type"]) # "product landing page"
print(data["primary_cta"]) # "Start now"
print(data["technologies"]) # ["React", "Next.js", "Cloudflare"]
# URL → PDF
pdf = client.pdf("https://github.com", format="A4")
open("page.pdf", "wb").write(pdf)
# HTML → image (OG cards, email previews)
html = '<div style="background:#0d0d0f;color:#fff;padding:80px;font-size:48px">My OG Card</div>'
img = client.render(html, width=1200, height=630)
open("og-card.png", "wb").write(img)
# Batch (multiple URLs)
results = client.batch(["https://a.com", "https://b.com"], endpoint="metadata")
for r in results:
print(r["url"], r.get("title"))
API Key
Get a free key (100 calls/month, no credit card) at https://snapapi.tech.
export SNAPAPI_KEY=snap_your_key_here
Or pass it directly: client = SnapAPI(api_key="snap_your_key_here")
Methods
| Method | Returns | Description |
|---|---|---|
screenshot(url, **kwargs) |
bytes |
PNG/JPEG/WebP image |
metadata(url) |
dict |
OG tags, title, favicon, canonical |
analyze(url, screenshot=False) |
dict |
Page type, CTA, tech stack, + optional screenshot |
pdf(url, **kwargs) |
bytes |
PDF binary |
render(html, **kwargs) |
bytes |
HTML → image |
batch(urls, endpoint, params) |
list[dict] |
Parallel multi-URL processing |
Full parameter reference: snapapi.tech/docs
Requirements
- Python 3.8+
- No third-party dependencies
License
MIT
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
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 snapapi_python-0.1.1.tar.gz.
File metadata
- Download URL: snapapi_python-0.1.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a0c4e6e9210d5f9249cb64162058d5f3e6c5bcb2fd7af3a1db4171c55c705b1
|
|
| MD5 |
9f8bdad69e229a4e84130d04d6798480
|
|
| BLAKE2b-256 |
22a87c924fcd7906568b9e4d74bf97e61faf5d9c4607295a13638b4df4c0e40d
|
File details
Details for the file snapapi_python-0.1.1-py3-none-any.whl.
File metadata
- Download URL: snapapi_python-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca92968befff3d1a1a8fbc316f633a52e4a3d2353235148c6d057a09e1a4cec9
|
|
| MD5 |
8bb8c6320b40093fe2d2a24d67945e18
|
|
| BLAKE2b-256 |
8fb4cc4cf86c583e2dcd61080d6c255bdc6809ee010739cb6265342fa7e967a4
|