Python SDK for the ScanLyser API — accessibility, SEO, performance, UX, and security scanning.
Project description
ScanLyser Python SDK
Official Python SDK for the ScanLyser API. Run accessibility, SEO, performance, UX, and security scans programmatically.
Requirements
- Python 3.10+
- httpx
Installation
pip install scanlyser-sdk
Quick Start
from scanlyser import Client
client = Client(api_key="your-api-token")
# List your sites
sites = client.sites(team_id).list()
for site in sites.data:
print(f"{site.name}: {site.url}")
# Trigger a scan
scan = client.scans(team_id).trigger(site_id, wcag_level="AA")
# Wait for completion
scan = client.scans(team_id).await_completion(scan.id)
# Get issues
issues = client.issues(team_id).list(scan.id, severity="critical")
API Reference
Client
client = Client(
api_key="your-api-token",
max_retries=3, # optional, retries on 429
)
Teams
teams = client.teams().list()
team = client.teams().get(team_id)
Sites
sites = client.sites(team_id).list(per_page=15)
site = client.sites(team_id).create(name="My Site", url="https://example.com")
site = client.sites(team_id).get(site_id)
client.sites(team_id).delete(site_id)
Scans
scans = client.scans(team_id).list(site_id)
scan = client.scans(team_id).trigger(site_id, wcag_level="AA")
scan = client.scans(team_id).get(scan_id)
# Poll until complete (default: 600s timeout, 10s interval)
scan = client.scans(team_id).await_completion(
scan_id,
timeout_seconds=600,
poll_interval_seconds=10,
)
Pages
pages = client.pages(team_id).list(scan_id)
page = client.pages(team_id).get(scan_id, page_id)
Issues
issues = client.issues(team_id).list(scan_id)
critical = client.issues(team_id).list(scan_id, category="wcag", severity="critical")
Reports
report = client.reports(team_id).json(scan_id)
client.reports(team_id).pdf(scan_id, save_to="/path/to/report.pdf")
Webhook Verification
Verify webhook signatures from scan completion callbacks:
from scanlyser import verify_webhook_signature
is_valid = verify_webhook_signature(
payload=request.body,
signature=request.headers["X-Signature"],
secret=token_hash,
)
Error Handling
The SDK raises typed exceptions for API errors:
from scanlyser import NotFoundError, ValidationError, RateLimitError
try:
site = client.sites(team_id).get("nonexistent")
except NotFoundError:
# 404
pass
except ValidationError as error:
# 422 — error.errors contains field-level errors
print(error.errors)
except RateLimitError:
# 429 — automatic retries exhausted
pass
Rate-limited requests (429) are automatically retried up to 3 times with the Retry-After delay.
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 scanlyser_sdk-1.0.0.tar.gz.
File metadata
- Download URL: scanlyser_sdk-1.0.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2441e84f9a2c6cfc2892671c8f2a03e7965d5d2af7eb2a46e34b2751b410f092
|
|
| MD5 |
cec10501acb37ab949c19d0d084f6d9f
|
|
| BLAKE2b-256 |
d3894d89da6a330ba299f994f89b5d78692287ef238fa12c1229916cb0755cde
|
File details
Details for the file scanlyser_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: scanlyser_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
339f0b37380df19484fc6d90bf660167578d2c37aa7e8889b895603a6ce247cc
|
|
| MD5 |
ac14509cc3c300fb4aa28a4631f94857
|
|
| BLAKE2b-256 |
8e5305092451a8589c25abc5708ca9641054d0309dec4ad2104da873869ef1e2
|