Skip to content

Instantly share code, notes, and snippets.

@withzombies
Created February 28, 2023 13:36
Show Gist options
  • Save withzombies/91b3cdafb223988ccadb5163cc7351bc to your computer and use it in GitHub Desktop.
Save withzombies/91b3cdafb223988ccadb5163cc7351bc to your computer and use it in GitHub Desktop.
A Zapier step to validate a reCaptcha.
import requests
input_data['success'] = 'false'
captcha = input_data.get('captcha')
if captcha is None:
return input_data
body = {
'secret': 'SECRET',
'response': captcha
}
r = requests.post("https://www.google.com/recaptcha/api/siteverify", params=body)
if r.ok:
j = r.json()
input_data['success'] = "true" if j.get('success', False) else "false"
input_data['captcha-debug'] = j
return input_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment