sfwapi
Official Python client for the SFW API: nudity detection and image moderation for images, GIFs and videos. Every result carries one of four content levels (0 Everyday, 1 Revealing, 2 Implied nudity, 3 Explicit), a score per level, and flags for drawn content and adult objects. Media is processed in memory and never stored.
pip install sfwapi
Get a free API key at sfwapi.dev/console.
from sfwapi import SfwApi
api = SfwApi(api_key="sk_live_...")
r = api.analyze_url("https://example.com/photo.jpg", policy={"block_level": 2, "block_sex_objects": True})
print(r["nudity"]["level"], r["nudity"]["scores"], r["policy"]["blocked"], r["usage"]["balance"])
with open("clip.gif", "rb") as f:
g = api.analyze_bytes(f.read(), max_frames=5, include_frames=True)
AsyncSfwApi offers the same methods with await. Errors raise SfwApiError with .status, .code,
.message, .request_id; 429/503/504 are retried twice honouring Retry-After (not for uploads).
A request costs 1 credit per image, or 1 per analysed frame for a GIF or video; failed requests are free.
Full reference: sfwapi.dev/docs/sdks/python.
Metadata
Release files for sfwapi 0.1.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 |
|---|---|---|---|---|
| sfwapi-0.1.0.tar.gz | 4.2 kB | Without provenance | Details for sfwapi-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sfwapi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sfwapi-0.1.0-py3-none-any.whl |
Total release size: 8.1 kB
Release files / sfwapi-0.1.0.tar.gz
| Download URL | sfwapi-0.1.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b5fec0d08e9265cf9bb06e544c87e6fea2cc4a531a370ede412fb0c08d18207
|
|
BLAKE2b-256 checksum How to use checksums |
7f04577c09d8dc64c6fc40ddbac7695347834dafe5a877f30071e7a15340076c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / sfwapi-0.1.0-py3-none-any.whl
| Download URL | sfwapi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
892e520cbfc0e98534f012afcdd51a9d1b6125a71c93d7600a5abc981c4b8117
|
|
BLAKE2b-256 checksum How to use checksums |
aa02fbc3c1bb97b105fc6eee30c880f9eef79490fb0e05760fd9cdb2c728dfd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for sfwapi 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.