A Django REST Framework field and serializer for Google reCAPTCHA (v2 and v3) verification. Current version 4.0.3 supports Django ≥4.2, Python ≥3.10, DRF ≥3.14. Released irregularly; latest updates add Django 5.2 and Python 3.13 support.
pip install drf-recaptchaVerified import paths — ran on the pinned version, not inferred.
Quickstart: define a serializer inheriting ReCaptchaSerializer. Configure DRF_RECAPTCHA_SECRET_KEY in Django settings. For testing, set DRF_RECAPTCHA_TESTING=True to bypass verification.
Ensure Django ≥4.2, Python ≥3.10, DRF ≥3.14 before upgrading to drf-recaptcha ≥4.0.
Add `Meta.exclude = ['recaptcha']` or use `fields` to limit output fields.
Upgrade to ≥3.2.0 if you need a required score of 0. Now a score of 0 correctly allows all traffic.
Use `DRF_RECAPTCHA_TESTING=True` only in test environments; for real bypass consider using a mock serializer.
Always pass the intended secret key explicitly when using multiple keys: `ReCaptchaField(secret_key='...')`.