我正在尝试使用名为pyotrs的python库登录OTRS服务器。当我尝试运行以下代码时,
from pyotrs import Client
client = Client("https://dev-otrs.samp.net", "myuser", "12345")
t = client.session_create()
出现类似证书验证失败]的问题>。下面给出了日志,
Traceback (most recent call last): File "/home/myname/.local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket cnx.do_handshake() File "/usr/local/lib/python3.6/dist-packages/OpenSSL/SSL.py", line 1915, in do_handshake self._raise_ssl_error(self._ssl, result) File "/usr/local/lib/python3.6/dist-packages/OpenSSL/SSL.py", line 1647, in _raise_ssl_error _raise_current_error() File "/usr/local/lib/python3.6/dist-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/myname/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen chunked=chunked, File "/home/myname/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 376, in _make_request self._validate_conn(conn) File "/home/myname/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn conn.connect() File "/home/myname/.local/lib/python3.6/site-packages/urllib3/connection.py", line 394, in connect ssl_context=context, File "/home/myname/.local/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/home/myname/.local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 491, in wrap_socket raise ssl.SSLError("bad handshake: %r" % e) ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/myname/.local/lib/python3.6/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/home/myname/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 720, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/home/myname/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 436, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='dev-otrs.samp.net', port=443): Max retries exceeded with url: /otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Session (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/pyotrs/lib.py", line 1897, in _send_request auth=self.auth) File "/home/myname/.local/lib/python3.6/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "/home/myname/.local/lib/python3.6/site-packages/requests/sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "/home/myname/.local/lib/python3.6/site-packages/requests/sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "/home/myname/.local/lib/python3.6/site-packages/requests/adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='dev-otrs.samp.net', port=443): Max retries exceeded with url: /otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Session (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "otrs_test.py", line 8, in <module> t = client.session_create() File "/usr/local/lib/python3.6/dist-packages/pyotrs/lib.py", line 1023, in session_create if not self._parse_and_validate_response(self._send_request(payload)): File "/usr/local/lib/python3.6/dist-packages/pyotrs/lib.py", line 1906, in _send_request "Error with http communication: {0}".format(err)) pyotrs.lib.HTTPError: Failed to access OTRS. Check Hostname, Proxy, SSL Certificate! Error with http communication: HTTPSConnectionPool(host='dev-otrs.samp.net', port=443): Max retries exceeded with url: /otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Session (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))
我尝试使用http和https都给出相同的结果。为什么会出现此错误以及如何解决。预先感谢。
我正在尝试使用名为pyotrs的python库登录OTRS服务器。当我尝试运行以下代码时,从pyotrs导入Client client = Client(“ https://dev-otrs.samp.net”,“ myuser”,“ 12345”)t ...
https_verify = False)]]