This library no longer works on python 2.7
Opened this issue · 2 comments
dyn==1.8.1 with python 2.7
from dyn.tm.zones import *
from dyn.tm.errors import DynectAuthError
print(DynectSession(
'organization', 'user','xxxxx'))
Will raise dyn.tm.errors.DynectAuthError
Traceback (most recent call last):
File "libdynect.py", line 379, in
'organization', 'user','xxxxx'))
File "/usr/local/lib/python2.7/site-packages/dyn/core.py", line 51, in call
cur_thread: super(_Singleton, cls).call(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/dyn/tm/session.py", line 57, in init
self.authenticate()
File "/usr/local/lib/python2.7/site-packages/dyn/tm/session.py", line 178, in authenticate
raise DynectAuthError('Unable to access the API host')
dyn.tm.errors.DynectAuthError: Unable to access the API host
This happens when the requests.get() fails generally
try:
response = self.execute('/Session/', 'POST', api_args)
except IOError:
raise DynectAuthError('Unable to access the API host')
I'm seeing this same issue on Python 3.7
This is the full traceback that caused the IOError:
Traceback (most recent call last):
File "env/lib/python3.7/site-packages/dyn/tm/session.py", line 176, in authenticate
response = self.execute('/Session/', 'POST', api_args)
File "env/lib/python3.7/site-packages/dyn/core.py", line 382, in execute
self.send_command(uri, method, args)
File "env/lib/python3.7/site-packages/dyn/core.py", line 459, in send_command
self._conn.endheaders()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1392, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 412, in wrap_socket
session=session
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 850, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1108, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)