Skip to content

Instantly share code, notes, and snippets.

@svenstaro
Created November 24, 2014 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svenstaro/04b7c0ec8421ff8b2c64 to your computer and use it in GitHub Desktop.
Save svenstaro/04b7c0ec8421ff8b2c64 to your computer and use it in GitHub Desktop.
def verify_recaptcha(challenge, response, private_key, remote_ip):
payload = {
"privatekey": private_key,
"remoteip": remote_ip,
"challenge": challenge,
"response": response
}
resp = requests.post("https://www.google.com/recaptcha/api/verify", data=payload)
resp_data = resp.text.splitlines()
return resp.status_code == requests.codes.ok and (resp_data[0] == 'true')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment