Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: __init__() got an unexpected keyword argument 'check_hostname' in GAE with https

I have the following error when using gae:

TypeError: __init__() got an unexpected keyword argument 'check_hostname'

Stacktrace:

File "C:\Dev\PycharmProjects\spiralai\default\src\facebook.py", line 99, in get_object
    return self.request(id, args)
  File "C:\Dev\PycharmProjects\spiralai\default\src\facebook.py", line 304, in request
    urllib.urlencode(args), post_data)
  File "C:\Python2764\Lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python2764\Lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "C:\Python2764\Lib\urllib2.py", line 449, in _open
    '_open', req)
  File "C:\Python2764\Lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Python2764\Lib\urllib2.py", line 1241, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "C:\Python2764\Lib\urllib2.py", line 1166, in do_open
    h = http_class(host, timeout=req.timeout, **http_conn_args)

Basically it happens with default use of urllib2 when connecting to HTTPS. check_hostname is not used in my code, its in urllib2. And the error because GAE replace http_class to google.appengine.dist27.gae_override.httplib.HTTPSConnection . Which apparently doesn't have a such argument in the method which is expected in urllib2. Is there a way to workaround this? Basically all packages that use urllib2 and make connect to https doesn't work at all. This is ridiculous. Python 2.7.9 x64 and latest GAE

like image 961
Aldarund Avatar asked Jul 28 '26 05:07

Aldarund


1 Answers

Upgrading python from 2.7.9 to 2.7.10 solved the issue.

like image 189
Aldarund Avatar answered Jul 29 '26 20:07

Aldarund



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!