Metadata-Version: 2.4
Name: cripcha
Version: 1.0.3
Summary: Server side check of Cripcha tokens (Django, Flask, FastAPI): the privacy-first, cookie-free captcha hosted in the EU
Author-email: Crispy Medias <contact@crispy-medias.fr>
License-Expression: MIT
Project-URL: Homepage, https://cripcha.crispy-medias.fr
Project-URL: Documentation, https://cripcha.crispy-medias.fr
Project-URL: Source, https://github.com/cripcha/cripcha-python
Keywords: captcha,cripcha,anti-spam,gdpr,django,flask,fastapi
Classifier: Programming Language :: Python :: 3
Classifier: Framework :: Django
Classifier: Framework :: Flask
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Security
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: django
Requires-Dist: django>=4.2; extra == "django"
Provides-Extra: flask
Requires-Dist: flask>=2.3; extra == "flask"
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.100; extra == "fastapi"
Requires-Dist: python-multipart; extra == "fastapi"

# cripcha

Server side check of [Cripcha](https://cripcha.crispy-medias.fr) tokens for Python 3.9+: Django, Flask, FastAPI. No dependency.

```bash
pip install cripcha            # or: pip install "cripcha[django]", "cripcha[flask]", "cripcha[fastapi]"
```

```python
from cripcha import verify, TOKEN_FIELD
result = verify(form_data.get(TOKEN_FIELD), secret=os.environ["CRIPCHA_SECRET"])
```

Django (`CRIPCHA_SITE_KEY`, `CRIPCHA_SECRET` in the settings; `"cripcha"` in `INSTALLED_APPS` for the translated
message):

```python
from cripcha.django import CripchaField
class ContactForm(forms.Form):
    message = forms.CharField(widget=forms.Textarea)
    cripcha = CripchaField()
```

Flask: `cripcha = Cripcha(app)`, `cripcha.verify_request()` in the view, `{{ cripcha_widget() }}` in the template.

FastAPI: `guard = CripchaGuard(secret=…)` then `Depends(guard)` on the route (403 when refused).

Fails closed, never raises for an API error. Test secrets: `cs_test_always_pass` / `cs_test_always_fail`.
