urllib 報錯 IOError: [Errno socket error] TLS/SSL connection has been closed (EOF) (_ssl.c:590)

解決方案:html

My evil workaround (don't do this in production!):python

import urllib2  #也能夠是urllib
import ssl

ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

urllib2.urlopen("https://your-test-server.local", context=ctx)

  

According to docs calling SSLContext constructor directly should work, too. I haven't tried that.this

相關文章
相關標籤/搜索