0

Python3 で robobrowser 経由で URL にアクセスしようとしていますが、SSL エラーが発生します。私は HTML と SSL について十分に理解していないので、ここまでたどり着くことができず、Google 検索はあまり役に立たないことがわかっています... 他のいくつかの URL を試してみましたが、うまくいきました。

これが私のコードです:

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))

エラーは次のとおりです。

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)'),))

どんな助けでも大歓迎です

4

0 に答える 0