Skip to main content

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

Project description

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.

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

django-hcaptcha-field-1.0.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distributions

django_hcaptcha_field-1.0.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

django_hcaptcha_field-1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file django-hcaptcha-field-1.0.0.tar.gz.

File metadata

  • Download URL: django-hcaptcha-field-1.0.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for django-hcaptcha-field-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4b9ac81af40a62ab3c553fde57683c9eeafb40e77ee68e8770caecabf31efb95
MD5 342dc5af48a17057ebd2d352ecd6a3a7
BLAKE2b-256 2d33185f89307b3daeaa059d48920d2133e1e3acbdf9afc9f3e8fff7af6e3db8

See more details on using hashes here.

File details

Details for the file django_hcaptcha_field-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: django_hcaptcha_field-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for django_hcaptcha_field-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2c1c446fddbc15367e8f0a223e293f859ee7d82fa7a094f60dea7833f73ad28
MD5 85c9438138aace6181c6e4bd4b33fd8a
BLAKE2b-256 862070b085836afaec233edc78829c8ff7e7f8a36dd191d778e58cd8ba96344d

See more details on using hashes here.

File details

Details for the file django_hcaptcha_field-1.0-py3-none-any.whl.

File metadata

  • Download URL: django_hcaptcha_field-1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for django_hcaptcha_field-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbcbe3e50e57f03eaff19b3ded62d18ec05baee54ba2c635e30693b03f628bb1
MD5 c1f1699269f2c321f38442b0d8f9983c
BLAKE2b-256 210cfcd02fbdf676b27dc13951bc79ca73714959f1912d9588de0f188bc3ff67

See more details on using hashes here.

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