Metadata-Version: 2.4
Name: infopeak-captcha
Version: 1.0.1
Summary: Server-side verification for InfoPeak Captcha - the privacy-first, EU-hosted captcha. No tracking, no cookies, no puzzles.
Author: InfoPeak
License: MIT
Project-URL: Homepage, https://infopeak.io/captcha
Project-URL: Documentation, https://infopeak.io/captcha/developers
Project-URL: Repository, https://github.com/infopeak/captcha-python
Project-URL: Issues, https://github.com/infopeak/captcha-python/issues
Keywords: captcha,spam,privacy,gdpr,recaptcha-alternative,hcaptcha-alternative,proof-of-work
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Security
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# InfoPeak Captcha for Python

Server-side verification for [InfoPeak Captcha](https://infopeak.io/captcha) - the privacy-first, EU-hosted captcha. No tracking, no cookies, no image puzzles.

## Install

```bash
pip install infopeak-captcha
```

Requires Python 3.8+. Zero dependencies (standard library only).

## Usage

Add the widget to your form ([full guide](https://infopeak.io/captcha/developers)):

```html
<form action="/signup" method="POST">
  <input type="email" name="email" required>
  <div class="infopeak-captcha" data-sitekey="YOUR_SITEKEY"></div>
  <button type="submit">Sign up</button>
</form>
<script src="https://captcha.infopeak.io/infopeak-captcha.js" defer></script>
```

Verify the token when the form is submitted (Flask example):

```python
import os
from infopeak_captcha import verify, FIELD

@app.post("/signup")
def signup():
    if not verify(
        request.form.get(FIELD),
        sitekey="YOUR_SITEKEY",
        secret=os.environ["INFOPEAK_CAPTCHA_SECRET"],
    ):
        return "Captcha verification failed", 400
    # ... proceed
```

Django works the same way with `request.POST.get(FIELD)`.

Need quota information too?

```python
from infopeak_captcha import verify_detailed

result = verify_detailed(token, sitekey="YOUR_SITEKEY", secret="YOUR_SECRET")
result.valid       # True when the token was genuine and unused
result.over_limit  # True when the sitekey is over its monthly quota
```

Verification fails closed: network errors and non-200 responses return `valid=False`.

## Testing

Public test credentials that work on any domain and never count against a quota (never use in production):

```
sitekey: ipk_test_sitekey
secret:  ipk_test_secret
```

## Links

- [Get a free sitekey](https://infopeak.io/captcha) - 10,000 verifications/month at no cost
- [Developer documentation](https://infopeak.io/captcha/developers)

## License

MIT
