我编写了.tsv
格式的Robot Framework测试脚本来测试Web服务/ API。当我开始收到以下错误时,一切都工作正常(可能是因为Robot Framework的新更新):
SSLError :("糟糕的握手:SysCallError(-1,'意外的EOF')",)
此错误会一直弹出测试脚本中的以下代码:
${headers}= Create Dictionary Content-Type application/json Accept application/json
RequestsKeywords.Get Request httpbin ${url} headers=${headers} //ERROR SHOWS FOR THIS STATEMENT
我确实得到了这个错误的详细回溯,如下所示:
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 = adapter.send(request, **kwargs)
File "/Library/Python/2.7/site-packages/requests/adapters.py", line 447, in send
raise SSLError(e, request=request)
我的系统配置:
Mac OS X (10.11.3)
Python (2.7.10)
openssl (1.0.2f)
requests (2.9.1)
robotframework (3.0)
robotframework-httplibrary (0.4.2)
robotframework-requests (0.4.4)
robotframework-ride (1.5.2.1)
robotframework-sshlibrary (2.1.2)
pyOpenSSL (0.15.1)
如何解决此问题?
答案 0 :(得分:3)
你们都是最新的,所以有两种可能性:
答案 1 :(得分:1)
尝试安装请求[安全]而不是请求。它使用PyOpenSSL,它比OpenSSL更好: pip install requests[security] vs pip install requests: Difference