0

I am trying to access a URL via robobrowser in Python3 but I get an SSL Error. I don't know enough about HTML and SSL to be able to get very far here and google searches are proving to be not very helpful... I have tried a few other URLs and they work fine.

Here is my code:

from robobrowser import RoboBrowser

url = "https://www.tech-inspect.com.au"
# url = "https://oasis.curtin.edu.au/Auth/LogOn" <-- tested fine

browser = RoboBrowser(history=True)
browser.open(url)
form = browser.get_form(action='HardcatLogin')   # Tech Inspect form
# form = browser.get_form(action='/Auth/Logon')  # Curtin form

print(form)
print(str(browser.select))

The error is this:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "C:\Program Files\Python36\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "C:\Program Files\Python36\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "C:\Program Files\Python36\lib\site-packages\urllib3\connection.py", line 326, in connect
    ssl_context=context)
  File "C:\Program Files\Python36\lib\site-packages\urllib3\util\ssl_.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Program Files\Python36\Lib\ssl.py", line 401, in wrap_socket
    _context=self, _session=session)
  File "C:\Program Files\Python36\Lib\ssl.py", line 808, in __init__
    self.do_handshake()
  File "C:\Program Files\Python36\Lib\ssl.py", line 1061, in do_handshake
    self._sslobj.do_handshake()
  File "C:\Program Files\Python36\Lib\ssl.py", line 683, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:749)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "C:\Program Files\Python36\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Program Files\Python36\lib\site-packages\urllib3\util\retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.tech-inspect.com.au', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:749)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/benco/IdeaProjects/TechInspect/beautifulSoup.py", line 7, in <module>
    browser.open(url)
  File "C:\Program Files\Python36\lib\site-packages\robobrowser\browser.py", line 205, in open
    response = self.session.request(method, url, **self._build_send_args(**kwargs))
  File "C:\Program Files\Python36\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Program Files\Python36\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "C:\Program Files\Python36\lib\site-packages\requests\adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.tech-inspect.com.au', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:749)'),))

Any help will be greatly appreciated

  • Possible duplicate of [this](https://stackoverflow.com/questions/33410577/python-requests-exceptions-sslerror-eof-occurred-in-violation-of-protocol) SO question. – Jeroen Heier Sep 01 '17 at 15:12
  • thanks for the suggestion I installed the `requests[security]` package and now the last line on the errors has change to this... `requests.exceptions.SSLError: HTTPSConnectionPool(host='www.tech-inspect.com.au', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')",),))` – Benjamin Cook Sep 02 '17 at 04:43
  • 1
    BANG got it!!! just set the max_age=0 and verify=False `browser = RoboBrowser(history=True, max_age=0) browser.open(url, verify=False)` – Benjamin Cook Sep 02 '17 at 05:29
  • I take that back, it worked because I have Fiddler running in the background – Benjamin Cook Sep 02 '17 at 10:22

0 Answers0