def validate_captcha(captcha_post):
"""
Validates the Google re-captcha data.
:param str captcha_post: The re-captcha post data
:return bool:
"""
validated = False
data = {
'secret': settings.GOOGLE_RECAPTCHA_SECRET_KEY,
'response': captcha_post
}
response = requests.post('https://www.google.com/recaptcha/api/siteverify', data=data, verify=False).json()
if response['success']:
validated = True
return validated
评论列表
文章目录