Aldarund
Aldarund

Reputation: 17621

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

Upvotes: 3

Views: 1283

Answers (1)

Aldarund
Aldarund

Reputation: 17621

Upgrading python from 2.7.9 to 2.7.10 solved the issue.

Upvotes: 2

Related Questions