Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 906 Bytes

README.md

File metadata and controls

27 lines (19 loc) · 906 Bytes

unprofane

The Python client for Unprofane, a profanity and toxicity API that is hard to fool.

pip install unprofane
from unprofane import Unprofane

client = Unprofane("up_live_YOUR_KEY")
r = client.check("xXsh1tXx", context="username", policy="teen")
if not r["allowed"]:
    print(r["action"], r["evasion"], r["censored"])

Async:

from unprofane import AsyncUnprofane

async with AsyncUnprofane("up_live_YOUR_KEY") as client:
    r = await client.check("hello", context="comment")

check, check_batch (up to 100 texts and 30,000 characters), check_many (any number, chunked to fit a batch), feedback, usage, get_list, put_list, delete_list. Retries 429 and 5xx with jitter and honors Retry-After; other failures raise UnprofaneError with the problem details and the request id. Docs: https://unprofane.com/docs/.