Python3 robobrowser SSL错误

时间:2017-09-01 15:04:04

标签: python-3.x ssl webforms robobrowser

我正在尝试通过Python3中的robobrowser访问URL,但是我收到了SSL错误。我不太了解HTML和SSL,因此能够在这里走得很远,谷歌搜索被证明不是很有帮助......我尝试过其他一些网址并且工作正常。

这是我的代码:

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

非常感谢任何帮助

0 个答案:

没有答案