sassoftware / python-sasctl

Python package and CLI for user-friendly integration with SAS Viya
https://sassoftware.github.io/python-sasctl
Apache License 2.0
46 stars 41 forks source link

NoneType Session doesn't raise any errors with verify_ssl=False #151

Closed smlindauer closed 1 year ago

smlindauer commented 1 year ago

Describe the issue After "connecting" to a Session with verify_ssl=False set in the argument in which the session does not create a successful connection to the SAS Viya server, the user is not provided with any indication that the session is actually invalid. Call attempts through sasctl function usage causes AttributeError: 'NoneType' object has no attribute 'upper', traced to sasctl.core.py in version_info line 839.

To Reproduce Aim a session instance at an http server without specifying protocol="http" and setting verify_ssl=False. Then attempt any function call that sends an API to the server.

Expected behavior Should we have a check on the Session instance that checks to see if the connection actually exists? Or perhaps a check when it hits the version check step to spit out a warning or error that the session did not properly connect?

Version v1.8.2

jlwalke2 commented 1 year ago

Fixed in d0b39ec.

Issue isn't that the session is None, it's that the release parsed out of the JSON response is None. The version_info() method was making the bad assumption that any good HTTP response would also always include the expected JSON payload.