fix recaptcha2 for python3
This commit is contained in:
+2
-2
@@ -905,14 +905,14 @@ class Recaptcha2(DIV):
|
|||||||
})
|
})
|
||||||
request = urllib2.Request(
|
request = urllib2.Request(
|
||||||
url=self.VERIFY_SERVER,
|
url=self.VERIFY_SERVER,
|
||||||
data=params,
|
data=to_bytes(params),
|
||||||
headers={'Content-type': 'application/x-www-form-urlencoded',
|
headers={'Content-type': 'application/x-www-form-urlencoded',
|
||||||
'User-agent': 'reCAPTCHA Python'})
|
'User-agent': 'reCAPTCHA Python'})
|
||||||
httpresp = urllib2.urlopen(request)
|
httpresp = urllib2.urlopen(request)
|
||||||
content = httpresp.read()
|
content = httpresp.read()
|
||||||
httpresp.close()
|
httpresp.close()
|
||||||
try:
|
try:
|
||||||
response_dict = json.loads(content)
|
response_dict = json.loads(to_native(content))
|
||||||
except:
|
except:
|
||||||
self.errors['captcha'] = self.error_message
|
self.errors['captcha'] = self.error_message
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user