Skip to main content

Django hCaptcha Field

Python unit tests Linters

Django hCaptcha Field provides a simple way to protect your Django forms using hCaptcha.

This is a fork of django-hcaptcha.

Installation

  1. Install using pip:

    $ pip install django-hcaptcha-field
    
  2. Add to INSTALLED_APPS:

    INSTALLED_APPS = [
        # ...
        'hcaptcha_field'
    ]
    

Configuration

For development purposes no further configuration is required. By default, Django hCaptcha Field will use test keys.

For production, you'll need to obtain your hCaptcha site key and secret key and add them to you settings:

HCAPTCHA_SITEKEY = '<your sitekey>'
HCAPTCHA_SECRET = '<your secret key>'

You can also configure your hCaptcha widget globally (see all options):

HCAPTCHA_DEFAULT_CONFIG = {
    'onload': 'name_of_js_function',
    'render': 'explicit',
    'theme': 'dark',  # do not use data- prefix
    'size': 'compact',  # do not use data- prefix
    # ...
}

If you need to, you can also override default hCaptcha endpoints:

HCAPTCHA_JS_API_URL = 'https://hcaptcha.com/1/api.js'
HCAPTCHA_VERIFY_URL = 'https://hcaptcha.com/siteverify'

Use proxies:

HCAPTCHA_PROXIES = {
   'http': 'http://127.0.0.1:8000',
}

Change default verification timeout:

HCAPTCHA_TIMEOUT = 5

Usage

Simply add hCaptchaField to your forms:

from hcaptcha_field import hCaptchaField

class Form(forms.Form):
    hcaptcha = hCaptchaField()

You can override the sitekey and other default configuration by passing additional arguments:

from hcaptcha_field import hCaptchaField

class Form(forms.Form):
    hcaptcha = hCaptchaField(sitekey='...', theme='dark', size='compact')

License

The scripts and documentation in this project are released under the BSD-3-Clause License.

Metadata

Release files for django-hcaptcha-field 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-hcaptcha-field 1.4.0
File Size Uploaded
django-hcaptcha-field-1.4.0.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-hcaptcha-field 1.4.0
File Interpreter ABI Platform
django_hcaptcha_field-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / django-hcaptcha-field-1.4.0.tar.gz

Download URL django-hcaptcha-field-1.4.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bcf2f698b1dc5f8ce411c11696df5785298df0cbd2fa564b09bd96609060bf34
BLAKE2b-256 checksum
How to use checksums
aca51555d918d03cb2a553f7d180bb7a40b5d2c190285cb191fe83da8a9c13b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / django_hcaptcha_field-1.4.0-py3-none-any.whl

Download URL django_hcaptcha_field-1.4.0-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36001030f53af709db3be01bf1d25023706b701bb7130f67f2aa58900b20df42
BLAKE2b-256 checksum
How to use checksums
c39a977f3f63f9183fda6573743db72c433ee293e4c5551dfa007713fa7877c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

3 release files

0.9.1

2 release files

0.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page