Skip to content

Instantly share code, notes, and snippets.

@ihfazhillah
Created May 22, 2019 07:03
Show Gist options
  • Save ihfazhillah/665013154340c44554d9affb92fac531 to your computer and use it in GitHub Desktop.
Save ihfazhillah/665013154340c44554d9affb92fac531 to your computer and use it in GitHub Desktop.
secret_key = settings.RECAPTCHA_SECRET_KEY
# captcha verification
data = {
'response': data.get('g-recaptcha-response'),
'secret': secret_key
}
resp = requests.post('https://www.google.com/recaptcha/api/siteverify', data=data)
result_json = resp.json()
print(result_json)
if not result_json.get('success'):
return render(request, 'contact_sent.html', {'is_robot': True})
# end captcha verification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment