tableau / server-client-python

A Python library for the Tableau Server REST API
https://tableau.github.io/server-client-python/
MIT License
655 stars 421 forks source link

SSLError #599

Closed kfburke closed 2 years ago

kfburke commented 4 years ago

Hi, I run the follow code many ways and ultimately cannot figure this out, after days searching here and other sites with no joy, hoping someone can help.

Thanks to anyone that responds,

Code is import tableauserverclient as TSC tableau_auth = TSC.TableauAuth("xxxxxxxxx_name", "xxxxxxxxx_pwd", "Default") server = TSC.Server("https://xxxxxxxxx_url", use_server_version=True) server.auth.sign_in(tableau_auth)

Error is at the bottom of the errmsg is: SSLError: HTTPSConnectionPool(host='dc-p-tableau', port=80): Max retries exceeded with url: /api/2.4/serverInfo (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')])")))

full errmsg is:

Error Traceback (most recent call last) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname) 484 try: --> 485 cnx.do_handshake() 486 except OpenSSL.SSL.WantReadError:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\OpenSSL\SSL.py in do_handshake(self) 1933 result = _lib.SSL_do_handshake(self._ssl) -> 1934 self._raise_ssl_error(self._ssl, result) 1935

~\AppData\Local\Continuum\anaconda3\lib\site-packages\OpenSSL\SSL.py in _raise_ssl_error(self, ssl, result) 1670 else: -> 1671 _raise_current_error() 1672

~\AppData\Local\Continuum\anaconda3\lib\site-packages\OpenSSL_util.py in exception_from_error_queue(exception_type) 53 ---> 54 raise exception_type(errors) 55

Error: [('SSL routines', 'ssl3_get_record', 'wrong version number')]

During handling of the above exception, another exception occurred:

SSLError Traceback (most recent call last) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 671 headers=headers, --> 672 chunked=chunked, 673 )

~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 375 try: --> 376 self._validate_conn(conn) 377 except (SocketTimeout, BaseSSLError) as e:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn) 993 if not getattr(conn, "sock", None): # AppEngine might not have .sock --> 994 conn.connect() 995

~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\connection.py in connect(self) 393 server_hostname=server_hostname, --> 394 ssl_context=context, 395 )

~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\util\ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password) 369 if HAS_SNI and server_hostname is not None: --> 370 return context.wrap_socket(sock, server_hostname=server_hostname) 371

~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname) 490 except OpenSSL.SSL.Error as e: --> 491 raise ssl.SSLError("bad handshake: %r" % e) 492 break

SSLError: ("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')])",)

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 448 retries=self.max_retries, --> 449 timeout=timeout 450 )

~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 719 retries = retries.increment( --> 720 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] 721 )

~\AppData\Local\Continuum\anaconda3\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 435 if new_retry.is_exhausted(): --> 436 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 437

MaxRetryError: HTTPSConnectionPool(host='dc-p-tableau', port=80): Max retries exceeded with url: /api/2.4/serverInfo (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')])")))

During handling of the above exception, another exception occurred:

SSLError Traceback (most recent call last)

in 1 tableau_auth = TSC.TableauAuth("svc_tableau", "T@bL3@u!", "Default") ----> 2 server = TSC.Server("https://dc-p-tableau:80", use_server_version=True) 3 4 server.auth.sign_in(tableau_auth) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\tableauserverclient\server\server.py in __init__(self, server_address, use_server_version) 60 61 if use_server_version: ---> 62 self.use_server_version() 63 64 def add_http_options(self, options_dict): ~\AppData\Local\Continuum\anaconda3\lib\site-packages\tableauserverclient\server\server.py in use_server_version(self) 100 101 def use_server_version(self): --> 102 self.version = self._determine_highest_version() 103 104 def use_highest_version(self): ~\AppData\Local\Continuum\anaconda3\lib\site-packages\tableauserverclient\server\server.py in _determine_highest_version(self) 90 old_version = self.version 91 self.version = "2.4" ---> 92 version = self.server_info.get().rest_api_version 93 except ServerInfoEndpointNotFoundError: 94 version = self._get_legacy_version() ~\AppData\Local\Continuum\anaconda3\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py in wrapper(self, *args, **kwargs) 125 def wrapper(self, *args, **kwargs): 126 self.parent_srv.assert_at_least_version(version) --> 127 return func(self, *args, **kwargs) 128 return wrapper 129 return _decorator ~\AppData\Local\Continuum\anaconda3\lib\site-packages\tableauserverclient\server\endpoint\server_info_endpoint.py in get(self) 16 """ Retrieve the server info for the server. This is an unauthenticated call """ 17 try: ---> 18 server_response = self.get_unauthenticated_request(self.baseurl) 19 except ServerResponseError as e: 20 if e.code == "404003": ~\AppData\Local\Continuum\anaconda3\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py in get_unauthenticated_request(self, url, request_object) 80 81 def get_unauthenticated_request(self, url, request_object=None): ---> 82 return self._make_request(self.parent_srv.session.get, url, request_object=request_object) 83 84 def get_request(self, url, request_object=None, parameters=None): ~\AppData\Local\Continuum\anaconda3\lib\site-packages\tableauserverclient\server\endpoint\endpoint.py in _make_request(self, method, url, content, request_object, auth_token, content_type, parameters) 51 parameters['data'] = content 52 ---> 53 server_response = method(url, **parameters) 54 self.parent_srv._namespace.detect(server_response.content) 55 self._check_status(server_response) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\sessions.py in get(self, url, **kwargs) 544 545 kwargs.setdefault('allow_redirects', True) --> 546 return self.request('GET', url, **kwargs) 547 548 def options(self, url, **kwargs): ~\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 531 } 532 send_kwargs.update(settings) --> 533 resp = self.send(prep, **send_kwargs) 534 535 return resp ~\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs) 644 645 # Send the request --> 646 r = adapter.send(request, **kwargs) 647 648 # Total elapsed time of the request (approximately) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 512 if isinstance(e.reason, _SSLError): 513 # This branch is for urllib3 v1.22 and later. --> 514 raise SSLError(e, request=request) 515 516 raise ConnectionError(e, request=request) SSLError: HTTPSConnectionPool(host='dc-p-tableau', port=80): Max retries exceeded with url: /api/2.4/serverInfo (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_record', 'wrong version number')])")))
KarthikINV commented 4 years ago

Try to add your server url and IP address into host file and retry

jacalata commented 2 years ago

Closing as stale.