giri-sh
giri-sh

Reputation: 6962

Robot Framework test scripts fail with SSLError

I have written Robot Framework test scripts in .tsv format to test web-services/APIs. Everything was working fine until today (probably because of the new updates of Robot Framework) when I started to get the following error:

SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

This error keeps popping up for the following code in a test script:

${headers}=  Create Dictionary Content-Type application/json  Accept application/json
RequestsKeywords.Get Request httpbin ${url} headers=${headers} //ERROR SHOWS FOR THIS STATEMENT

I did get a detailed traceback for this error which is as follows:

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)

My system configuration:

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)

How do I resolve this issue?

Upvotes: 12

Views: 7770

Answers (2)

fodma1
fodma1

Reputation: 3535

Try installing requests[security] instead of requests. It uses PyOpenSSL, which is better than OpenSSL: pip install requests[security] vs pip install requests: Difference

Upvotes: 1

L Martin
L Martin

Reputation: 1190

You're all up to date, so there are two possibilities:

  • The handshake isn't going smoothly because of a break in the trust chain. Start from the bottom and work up. Are you testing this on a local area network? Is the certificate up to date? Can you access the site from your location and others without an error? SSL labs showing anything up? What about firewall rules?
  • There's a bug in the recent update. OpenSSL reports in my experience are caused by connection issues rather than obscure software problems - this is the less likely of the two.

Upvotes: 3

Related Questions