Skip to main content

AsyncIO client for the hCaptcha service.

Project description

aiohcaptcha

AsyncIO client for the hCaptcha service

Secure your forms using a captcha.


Install

pip install aiohcaptcha

Usage

Configuration

You can define the secret key HCAPTCHA_SECRET_KEY in the environment or directly pass it to the HCaptchaClient model as a parameter.

Get the secret and public keys from the hcaptcha.com.

Template

<div class="h-captcha" data-sitekey="your_site_key"></div>
<script src="https://hcaptcha.com/1/api.js" async defer></script>

Check hCaptcha docs for more details on the HTML widget.

View

response_token = request.POST["h-captcha-response"]
client = HCaptchaClient(secret_key)
verified = await client.verify(response_token)  # a boolean

Response details

Response details are stored in client.response, details of the HCaptchaResponse model is same as the JSON response provided in the hCaptcha documentation.

Extra arguments

You can also add remote_ip and sitekey (expected key) to the client.verify function. These parameters are explain the the hCaptcha docs.


© 2020 Emin Mastizada. MIT Licenced.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiohcaptcha-0.1.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

aiohcaptcha-0.1.0-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page