fix recaptcha2 for python3

This commit is contained in:
Radu Ioan Fericean
2018-10-18 16:27:15 +03:00
parent 95709e582d
commit 7de0a3b53f
+2 -2
View File
@@ -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