Created
August 27, 2013 11:30
-
-
Save utek/6352412 to your computer and use it in GitHub Desktop.
Recaptcha helper.
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
def check_recaptcha(challenge, response, ip, private_key): | |
import requests | |
url = "http://www.google.com/recaptcha/api/verify" | |
data = { | |
'privatekey': private_key, | |
'remoteip': ip, | |
'challenge': challenge, | |
'response': response, | |
} | |
res = requests.post(url, data=data) | |
response = res.text.splitlines() | |
if response[0] == u'true': | |
return (True, response[1]) | |
else: | |
return (False, response[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment