Skip to content

sasctl connect issue with Viya #57

@venkattoluchuri

Description

@venkattoluchuri

with Session('XXXXXX', 'sas', 'XXXXXX'):
... pass # do something

Getting below ERROR when I try to assign a session:


SSLCertVerificationError Traceback (most recent call last)
C:\ProgramData\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)
599 body=body, headers=headers,
--> 600 chunked=chunked)
601

C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
342 try:
--> 343 self._validate_conn(conn)
344 except (SocketTimeout, BaseSSLError) as e:

C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py in _validate_conn(self, conn)
838 if not getattr(conn, 'sock', None): # AppEngine might not have .sock
--> 839 conn.connect()
840

C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py in connect(self)
343 server_hostname=server_hostname,
--> 344 ssl_context=context)
345

C:\ProgramData\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)
359
--> 360 return context.wrap_socket(sock)
361

C:\ProgramData\Anaconda3\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
422 context=self,
--> 423 session=session
424 )

C:\ProgramData\Anaconda3\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
869 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 870 self.do_handshake()
871 except (OSError, ValueError):

C:\ProgramData\Anaconda3\lib\ssl.py in do_handshake(self, block)
1138 self.settimeout(None)
-> 1139 self._sslobj.do_handshake()
1140 finally:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last)
C:\ProgramData\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 )

C:\ProgramData\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)
637 retries = retries.increment(method, url, error=e, _pool=self,
--> 638 _stacktrace=sys.exc_info()[2])
639 retries.sleep()

C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
398 if new_retry.is_exhausted():
--> 399 raise MaxRetryError(_pool, url, error or ResponseError(cause))
400

MaxRetryError: HTTPSConnectionPool(host='10.225.193.28', port=443): Max retries exceeded with url: /SASLogon/oauth/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)')))

During handling of the above exception, another exception occurred:

SSLError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
439 proxies, hooks, stream, verify,
--> 440 cert, json)
441 except requests.exceptions.SSLError as e:

C:\ProgramData\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)
532 send_kwargs.update(settings)
--> 533 resp = self.send(prep, **send_kwargs)
534

C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in send(self, request, **kwargs)
406
--> 407 response = super(Session, self).send(request, **kwargs)
408

C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
645 # Send the request
--> 646 r = adapter.send(request, **kwargs)
647

C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
513 # This branch is for urllib3 v1.22 and later.
--> 514 raise SSLError(e, request=request)
515

SSLError: HTTPSConnectionPool(host='10.225.193.28', port=443): Max retries exceeded with url: /SASLogon/oauth/token (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)')))

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last)
in
----> 1 with Session('10.225.193.28', 'sas', 'Growth17'):
2 pass # do something

C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in init(self, hostname, username, password, authinfo, protocol, port, verify_ssl)
329
330 self.verify = verify_ssl
--> 331 self.auth = HTTPBearerAuth(self.get_token())
332
333 if current_session() is None:

C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in get_token(self)
585 return self._get_token_with_kerberos()
586 else:
--> 587 return self._get_token_with_password()
588
589 def _build_url(self, url):

C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in _get_token_with_password(self)
555 data=data,
556 headers=headers,
--> 557 auth=('sas.ec', ''))
558
559 if r.status_code == 401:

C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py in post(self, url, data, json, **kwargs)
579 """
580
--> 581 return self.request('POST', url, data=data, json=json, **kwargs)
582
583 def put(self, url, data=None, **kwargs):

C:\ProgramData\Anaconda3\lib\site-packages\sasctl\core.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
442 if 'REQUESTS_CA_BUNDLE' not in os.environ:
443 raise RuntimeError(
--> 444 "SSL handshake failed. The 'REQUESTS_CA_BUNDLE' "
445 "environment variable should contain the path to the CA "
446 "certificate. Alternatively, set verify_ssl=False to "

RuntimeError: SSL handshake failed. The 'REQUESTS_CA_BUNDLE' environment variable should contain the path to the CA certificate. Alternatively, set verify_ssl=False to disable certificate verification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions