V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
nightv2
V2EX  ›  Python

访问 https 的网络接口出现 SSLError: ('The read operation timed out',)异常

  •  
  •   nightv2 · 2016-12-01 17:06:06 +08:00 · 6757 次点击
    这是一个创建于 2674 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用 Python v2.7.10 来访问两个设备(都是在内网,估计证书都很久了的),只有 https 的接口,就是访问一个网址,在 url 中传入参数,然后就会返回数据。 设置了全局不验证

    ssl._create_default_https_context = ssl._create_unverified_context

    response = urllib2.urlopen(url, timeout = 30) buf = response.read() response.close() 其中一个设备能顺利获取数据,另外一个就会报异常 SSLError: ('The read operation timed out',) 问下有啥思路么?搜了一圈没有找到

    第 1 条附言  ·  2016-12-02 15:32:43 +08:00
    问题解决了,就是访问超时,增加超时时间就可以了。

    之前是其他人调试的,说浏览器打开比较快。但是实际看一下,只是有时候浏览器打开比较快,也有很多时候打开比较慢。
    1 条回复    2016-12-01 17:34:51 +08:00
    TaMud
        1
    TaMud  
       2016-12-01 17:34:51 +08:00
    tool curl test ,可以帮你查问题
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3127 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 12:59 · PVG 20:59 · LAX 05:59 · JFK 08:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.