HTTPie 1.0.0-dev
HTTPie data: /Users/kaji/.httpie
Requests 2.5.3
Pygments 2.0.2
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] darwin
Not every SSL website shows though. So, it is tricky. From browser , it is working fine.
>>> requests.request({'allow_redirects': False,
'auth': None,
'cert': None,
'data': OrderedDict(),
'files': DataDict(),
'headers': {'User-Agent': 'HTTPie/1.0.0-dev'},
'method': 'get',
'params': ParamsDict(),
'proxies': {},
'stream': True,
'timeout': 30,
'url': u'https://apissl.example.com',
'verify': True})
Traceback (most recent call last):
File "/usr/local/bin/http", line 9, in <module>
load_entry_point('httpie==1.0.0-dev', 'console_scripts', 'http')()
File "/Library/Python/2.7/site-packages/httpie/core.py", line 112, in main
response = get_response(args, config_dir=env.config.directory)
File "/Library/Python/2.7/site-packages/httpie/client.py", line 41, in get_response
response = requests_session.request(**kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/Library/Python/2.7/site-packages/requests/adapters.py", line 431, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 8] _ssl.c:507: EOF occurred in violation of protocol
@kajisaap它是什么网址? apissl.example.com
无法解决。
@jakubroztocil我会粘贴它,但我讨厌在公开问题列表中看到公司的 URL。 这就是我粘贴调试日志的原因。 如果 api 端点 URL 对于调试目的至关重要,我如何私下向您发送消息?
@jakubroztocil ,假设这里的相似性https://github.com/kennethreitz/requests/issues/2056
似乎是上游问题。 尝试安装链接问题中提到的那些软件包。
尝试
$ pip install --force-reinstall requests[security]
@kajisaap请将 URL 发电子邮件给我,以便我可以为您提供更好的帮助。 我的电子邮件在我的个人资料页面上。
@sigmavirus24 sudo pip install --force-reinstall 'requests[security]' --upgrade
帮助。 如果系统信息可能会有所不同,我在 Yosemite 10.10.2
@kajisaap你也可以用openssl version
发表评论吗?
旁注: @jakubroztocil您对请求的调试调用是错误的。 requests.request
不会接受该字典。 它的价值必须是requests.request(**{ #...
。
@kajisaap还有python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
$>python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 0.9.8zc 15 Oct 2014
@sigmavirus24谢谢,已修复
所以我在 python 3.4.2 上的网站有 0 个问题。 所以这似乎是一个 SNI 问题。 作为参考,这是我的 openssl 版本:
>>> import ssl
>>> print(ssl.OPENSSL_VERSION)
OpenSSL 1.0.1l 15 Jan 2015
而且,我只安装了请求。
在 python 2.7.9 上,同样适用于相同的 openssl 版本。 有趣的是,在 py2.7.9 上的临时 virtualenv 中安装requests[security]
会失败(并提供不同的错误,因为 pyOpenSSL 的SysCallError
没有定义正确返回的__str__
方法格式化str
)。 该错误也是由于握手失败造成的。 我要么升级到 python 2.7.9(通过 brew 或 Python.org)并升级 openssl(通过 brew 和 force-linking)。 我也在 OSX 10.10
闻起来像 #262 / #288 的复制品。
@mathiasbynens 据我所知,这与 SNI 没有任何关系。 那就是说@kajisaap已停止响应,所以我:+1:因为不完整而关闭它。
@sigmavirus24我很困惑——你刚刚在之前的评论中说“所以这似乎是一个 SNI 问题” 。
我确认我也有这个错误:
$ http https://larlet.fr
http: error: SSLError: [Errno 8] _ssl.c:507: EOF occurred in violation of protocol
使用该版本的 OpenSSL 和 HTTPie:
$ python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.0.2 22 Jan 2015
$ http --version
0.9.2
我用请求的安全模块强制重新安装,没有任何改进。
我在尝试访问 localhost 上的 hello-world Dropwizard 应用程序时遇到了同样的问题(预期的响应是一个空的 JSON 数组)。
$ http --verify=no https://localhost:8443/hello
http: error: SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",) while doing GET request to URL: https://localhost:8443/hello
$ curl -k https://localhost:8443/hello
[]
我仍然看到这个:
$ python --version
Python 2.7.11
$ python -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.0.2f 28 Jan 2016
我尝试强制重新安装请求的安全模块:不高兴。
你好,
我在执行时遇到了 python 2.7.9 和 Requests 模块的相同问题
r = requests.get(url=urloo,headers=self.headers, verify=False)
与 urlloo = https://10.xxx.xx.xxxx :yyyyy/oo/rest/latest/executions/21589456/summary
请求返回:
发送中的文件“C:ApplicationsPython27libsite-packagesrequests-2.9.1-py2.7.eggrequestsadapters.py”,第 447 行
引发 SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 8] _ssl.c:507: EOF 发生违反协议
验证标头定位为 False
可能与 kennethreitz/requests#3006 有关
有人在 Python 2.7.6 中遇到过这个问题吗?
如果不是,这可能是相关的: http ://stackoverflow.com/questions/32330919/python-ssl-ssl-sslerror-ssl-unsupported-protocol-unsupported-protocol-ssl
我能够通过执行@sigmavirus24的建议来解决这个问题
pip install --force-reinstall requests[security]
这是 macOS Sierra 10.12 上的 python 2.7.10
https://github.com/jkbrzt/httpie#sni -server-name-indication
我刚刚在https://github.com/apache/fineract/pull/644上遇到了这个问题,在 Travis CI 上安装了任何版本的apt-get install httpie
(使用dist: trusty
)。 使用--verify=no
(不是--verify no
!)修复它。 (您不会希望将其用于带有 SSL 的公共网站;在我的情况下,它只是用于带有自签名证书的 https://localhost:8443/...。)
https://github.com/jkbrzt/httpie#sni -server-name-indication
仅供参考,这个锚似乎同时被移除了。
最有用的评论
尝试
@kajisaap请将 URL 发电子邮件给我,以便我可以为您提供更好的帮助。 我的电子邮件在我的个人资料页面上。