hostily-captcha (Python)
Deutsch
Kleiner Client für hostily Captcha. Python ≥ 3.9, nur Standardbibliothek; httpx wird für die
asynchrone Variante genutzt, wenn es installiert ist (sonst läuft die Standardbibliothek in einem Thread).
pip install hostily-captcha # optional: pip install "hostily-captcha[httpx]"
from hostily_captcha import Client, UnavailableError
captcha = Client(os.environ["HOSTILY_CAPTCHA_SECRET"]) # Secret nur auf dem Server!
try:
result = captcha.verify_form(request.form, remoteip=request.remote_addr)
except UnavailableError:
... # Dienst nicht erreichbar: blockieren oder durchlassen - Ihre Entscheidung
if result.success:
...
else:
print(result.gruende, result.punkte)
Async: from hostily_captcha import AsyncClient und await AsyncClient(secret).verify_form(form, remoteip).
verify(token, remoteip=None, formular=None);verify_form(form, remoteip=None, send_content=True)holt Token (hostily-captcha-token, sonstg-recaptcha-response) und Inhalt aus einem Mapping (dict, Django-QueryDict, Flask-form, …).token_from(form)undcontent(form): Letzteres entfernt Passwortfelder, Secrets, CSRF-Token, Kartencodes und die Token-Felder. Passwörter werden nie mitgeschickt.Result:success(auch alsbool(result)),gruende,punkte,error_codes,hostname,is_configuration_error.timeout=in Sekunden (Vorgabe 5),endpoint=für eine andere Adresse. Ohne Token wird der Dienst nicht gefragt (token_fehlt). Ein Token gilt nur für eine Prüfung.- Tests:
pip install -e ".[test]" && pytest.
English
Small client for hostily Captcha. Python ≥ 3.9, standard library only; httpx is used by the
async client when installed (otherwise the standard library runs in a worker thread). Install and use as above.
verify(token, remoteip=None, formular=None);verify_form(form, remoteip=None, send_content=True)takes the token (hostily-captcha-token, elseg-recaptcha-response) and the content from any mapping (dict, DjangoQueryDict, Flaskform, …).token_from(form)andcontent(form); the latter drops password fields, secrets, CSRF tokens, card codes and the token fields. Passwords are never sent.Result:success(alsobool(result)),gruende,punkte,error_codes,hostname,is_configuration_error.UnavailableError: service unreachable / timeout / HTTP 5xx or 429 / unreadable answer - you decide to block or let pass.timeout=in seconds (default 5),endpoint=for another address. Without a token the service is not called (token_fehlt). A token is valid for one check only. Tests:pip install -e ".[test]" && pytest.
MIT License.
Metadata
Release files for hostily-captcha 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 | |
|---|---|---|---|---|
| hostily_captcha-0.1.0.tar.gz | 7.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hostily_captcha-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / hostily_captcha-0.1.0.tar.gz
| Download URL | hostily_captcha-0.1.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dd6f3cc83fd834d12aaa88fd32618da79bc43da62355da2027e55c9a8e517c9
|
|
BLAKE2b-256 checksum How to use checksums |
d1f52ce69c541dec7a8c7c98ba7437cabe2ae3ff02ee643d282cf21d2ed5b20b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / hostily_captcha-0.1.0-py3-none-any.whl
| Download URL | hostily_captcha-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64192a81091cc7fc0068be730c9ffcc1afbb5775c49dbdecea60893020cef1d2
|
|
BLAKE2b-256 checksum How to use checksums |
f4fa45853b38a077ac8fc1a9907061ee3e5dc1187177b49b4bf0849638a87589
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for hostily-captcha 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.