CaptchaFox for Python
Official CaptchaFox integration for Python. It verifies the answers of the widget with CaptchaFox.
Compatibility
| Python | Library |
|---|---|
| 3.11, 3.12, 3.13, 3.14, 3.15 | 1.x |
Python 3.10 and older are not supported: pip does not install the library there.
Installation
pip install captchafox-python
Or add captchafox-python to the dependencies of your project. The library needs nothing but the standard library,
so without pip, unpack the folder captchafox from captchafox_python-<version>-py3-none-any.whl of the
releases, a ZIP archive, into a directory on your
sys.path.
Configuration
Get your keys
In the CaptchaFox portal, open your website under Sites > Site Details and copy the site key and the secret key.
Set up the library
Create a CaptchaFoxClient once with the secret key of your site and reuse it; it is thread-safe. Keep the secret key
in your configuration or environment, not in source code:
import os
from captchafox import CaptchaFoxClient
client = CaptchaFoxClient(os.environ["CAPTCHAFOX_SECRET"])
Options
| Option | Default | Meaning |
|---|---|---|
timeout |
5 seconds | How long a verification may take, from connecting to CaptchaFox to the end of its answer: CaptchaFoxClient(secret, timeout=3). Looking up the address of CaptchaFox comes before and is bounded by the system's resolver. |
Usage
The widget adds the token to the form as the POST parameter cf-captcha-response. Verify it on the server before
the form is processed, here in a Flask view:
from captchafox import VerificationUnavailableError
token = request.form.get("cf-captcha-response")
try:
verification = client.verify(token, SITE_KEY, request.remote_addr)
if not verification.passed:
... # Reject the form.
except VerificationUnavailableError:
... # CaptchaFox gave no usable answer: decide whether the form passes.
verify(token) sends the token alone; verify(token, sitekey, remote_ip) also sends the site key the token was
issued for and the visitor's IP address, each only when it is not None or empty.
A verification has one of three outcomes:
Passed: CaptchaFox accepted the token.challenge_tsandhostnamehold the time of the challenge and the hostname of the site, where CaptchaFox sent them.Rejected: CaptchaFox rejected the token;error_codesholds its error codes, such astimeout-or-duplicate, possibly none. An empty or missing token is rejected withmissing-input-responsewithout asking CaptchaFox.VerificationUnavailableError: CaptchaFox gave no usable answer; see If CaptchaFox is unreachable.
Operation
If CaptchaFox is unreachable
When CaptchaFox cannot be reached, does not complete its answer within the timeout, answers with an HTTP status other
than 200, or with a body that is no valid answer, verify raises VerificationUnavailableError. Your code decides
whether the form passes then: letting it through keeps your forms available during an outage, rejecting it keeps them
protected. Tokens that CaptchaFox rejects are always Rejected.
Log
The library logs nothing. The messages of its exceptions never contain the secret key.
Visitor IP
The visitor's IP address is sent only when you pass it as remote_ip. Behind a reverse proxy or load balancer, pass
the visitor's address that the proxy forwards, not the address of the proxy.
Privacy
CaptchaFox is operated by Scoria Labs GmbH, Germany. How CaptchaFox processes data and how to get a data processing agreement is described in the CaptchaFox Privacy Center. A suggested paragraph for your privacy policy is on the GDPR page.
License
Apache-2.0. See LICENSE.
Metadata
Release files for captchafox-python 1.0.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 | Actions |
|---|---|---|---|---|
| captchafox_python-1.0.0.tar.gz | 18.8 kB | With provenance | Details for captchafox_python-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| captchafox_python-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for captchafox_python-1.0.0-py3-none-any.whl |
Total release size: 29.2 kB
Release files / captchafox_python-1.0.0.tar.gz
| Download URL | captchafox_python-1.0.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3318340cc746e6dd6f75a05b8c7d9281167a263be28c7deb0911bebdeb6ec37f
|
|
BLAKE2b-256 checksum How to use checksums |
c0b45dd5b3a99b0fdb36c74e40b1c6933b397ec31ace68f9a5589d99d1e44fc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / captchafox_python-1.0.0-py3-none-any.whl
| Download URL | captchafox_python-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52200976e805d9ac851dcdd5d07d73b545c319205dafa0166a0f485a95e46c9e
|
|
BLAKE2b-256 checksum How to use checksums |
72987cebf56cdefe747e734b8e205048ee9b22d3b9c700f4e4ee8e482309ca9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for captchafox-python 1.0.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for captchafox_python-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA 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.