简体   繁体   中英

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

将python从2.7.9升级到2.7.10解决了这个问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM