我使用Python 2.7.3和请求.我通过pip安装了Requests.我相信这是最新版本.我正在使用Debian Wheezy.
我过去曾经多次使用过Requests并且从未遇到过这个问题,但似乎在Requests我发出https请求时会遇到InsecurePlatform异常.
错误提到urllib3,但我没有安装.我确实安装它以检查它是否解决了错误,但事实并非如此.
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3
/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not
available. This prevents urllib3 from configuring SSL appropriately and
may cause certain SSL connections to fail. For more information, see
https://urllib3.readthedocs.org/en/latest
/security.html#insecureplatformwarning.
Run Code Online (Sandbox Code Playgroud)
关于为什么我得到这个的任何想法?我已经检查了错误消息中指定的文档,但文档说要导入urllib3并禁用警告或提供证书.
我编写了Robot Framework测试脚本,.tsv用于测试Web服务/ API.当我开始收到以下错误时,一切都运行良好,直到今天(可能是因为Robot Framework的新更新):
SSLError :("握手不好:SysCallError(-1,'Unexpected EOF')",)
此错误不断弹出测试脚本中的以下代码:
${headers}= Create Dictionary Content-Type application/json Accept application/json
RequestsKeywords.Get Request httpbin ${url} headers=${headers} //ERROR SHOWS FOR THIS STATEMENT
Run Code Online (Sandbox Code Playgroud)
我确实得到了这个错误的详细回溯,如下所示:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/RequestsLibrary/RequestsKeywords.py", line 298, in get_request
session, uri, params, headers, redir, timeout)
File "/Library/Python/2.7/site-packages/RequestsLibrary/RequestsKeywords.py", line 801, in _get_request
cookies=self.cookies)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 576, in send
r = …Run Code Online (Sandbox Code Playgroud) 我正在尝试requests为 Python(CentOS6 上的 2.6.6)安装库作为
sudo pip install requests[security]
Run Code Online (Sandbox Code Playgroud)
我收到这些错误消息:
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Collecting requests[security]
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is …Run Code Online (Sandbox Code Playgroud) 我即将用来Python.requests将数据从我自己的网上获取api到我的本地电脑。我的 api 需要身份验证,目前只需发布用户/密码即可完成:
params = {'user': 'username', 'pass':'password'}
requests.post(url, params=params)
Run Code Online (Sandbox Code Playgroud)
这是否requests安全,或者是否会允许中间人捕获该用户/通行证?
PS 我的 api 使用 LetsEncrypt ssl 证书。Python版本3.7.0