Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

reCatpcha api v3.0 - with django support

Project description


A simple python module for Google Recaptcha V3

A pure python module, don't requires requests library


  • from latest version on PyPi:
    pip install crecaptcha

how to use?

from crecatpcha.crecaptcha import crecaptcha
SECRET_KEY = 'Your secret key'

def some_function():
    response_token = 'the response token from the client'
    if crecaptcha(SECRET_KEY, response_token, 'action_name'):
        # safe action
        # is a bot, take your custom action.

how to use with django?


In the define the following values:
CRECAPTCHA_SECRET_KEY: the recaptcha secret key.
CRECAPTCHA_KEY_NAME: the name of the var in the POST request, by default is 'recaptcha_token'.

CRECAPTCHA_SECRET_KEY = "jgjdnvurmfj3nrfo3nrlksjf" # Mandatory
CRECAPTCHA_KEY_NAME = "grecatpcha" # by default is 'recaptcha_token'


Simple way:

In the following example if the recaptcha validation fails, it will raise an HttpResponseForbidden

from crecatpcha.django_crecatpcha import crecaptcha

def login_user(request):
@crecaptcha('register', threshold=0.6)
def register_user(request):

Advance way:

You can define your custom callback when the validations fails, an optionally you can send args & kwargs.

from crecatpcha.django_crecatpcha import crecaptcha

def register_user_on_crecaptcha_error(request, *args, **kwargs):
@crecaptcha('register', register_user_on_crecaptcha_error, args_on_error=[], kwargs_on_error={})    
def register_user(request):

Project details

Download files

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

Files for crecaptcha, version 0.1.32
Filename, size File type Python version Upload date Hashes
Filename, size crecaptcha-0.1.32.tar.gz (7.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page