V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Dec 1, 2016 · 7393 views
    This topic created in 3435 days ago, the information mentioned may be changed or developed.

    用 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',) 问下有啥思路么?搜了一圈没有找到

    Supplement 1  ·  Dec 2, 2016
    问题解决了,就是访问超时,增加超时时间就可以了。

    之前是其他人调试的,说浏览器打开比较快。但是实际看一下,只是有时候浏览器打开比较快,也有很多时候打开比较慢。
    1 replies    2016-12-01 17:34:51 +08:00
    TaMud
        1
    TaMud  
       Dec 1, 2016
    tool curl test ,可以帮你查问题
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1025 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 22:09 · PVG 06:09 · LAX 15:09 · JFK 18:09
    ♥ Do have faith in what you're doing.