我试图在pythonweb应用程序中验证reCAPTCHA,但是我总是得到incorrect-captcha-sol
错误,尽管响应是正确的。以下是验证代码:
data = {
'privatekey': config.registry.settings['captcha_private_key'],
'remoteip': ip,
'challenge': challenge,
'response': response,
}
request = urllib2.Request('http://www.google.com/recaptcha/api/verify',
urllib.urlencode(data))
response = urllib2.urlopen(request)
if response.readline() != 'true':
log.error('Captcha validation error, error_code=%s' % (response.readline()))
raise httpexceptions.HTTPUnauthorized()
为了获得质询和响应值,我使用get_challenge()
和{
解决了这个问题。似乎
QUnit
自动javascript
测试以某种方式与catpcha交互,从而产生incorrect-captcha-sol
代码。在相关问题 更多 >
编程相关推荐