First-party SDK. Drop into any Django form route in under three lines.
The TrustedCaptcha Django SDK is open-source (MIT) and developed in the open at github.com/trustedcaptcha. It wraps the /api/v1/siteverify endpoint, handles secret lookup from environment, exposes a typed verification result, and provides the framework's idiomatic integration points (validation rule / form field / middleware as appropriate).
pip install trustedcaptcha-django
# settings.py
INSTALLED_APPS += ["trustedcaptcha"]
TRUSTEDCAPTCHA_SITEKEY = "0x..."
TRUSTEDCAPTCHA_SECRET = os.environ["TC_SECRET"]
# forms.py
from trustedcaptcha.fields import TrustedCaptchaField
class ContactForm(forms.Form):
email = forms.EmailField()
captcha = TrustedCaptchaField()
It's small enough you absolutely could roll your own — the verify call is one HTTP POST. The SDK exists because there are a handful of details worth getting right that aren't obvious from the API docs alone:
The SDK includes a test mode: when TC_SITEKEY is the documented test value (0x10000000000000000000000000000000ee), all verifications succeed locally without an HTTP call to our service. Useful for unit and integration tests without burning real verification budget.
The Django SDK includes typed return values for the verification result (success, score, mode, hostname, action, error_codes). You get autocomplete on the result fields rather than indexing into a generic associative array.
If your application can be DoS'd by sending many invalid tokens to verify, the SDK includes optional rate-limit guards keyed by IP. Default is off; enable with one configuration flag.
SDK issues on GitHub. Account/billing/integration help: support@trustedcaptcha.com.