Created
February 28, 2023 13:36
-
-
Save withzombies/91b3cdafb223988ccadb5163cc7351bc to your computer and use it in GitHub Desktop.
A Zapier step to validate a reCaptcha.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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