Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This library no longer works on python 2.7 #129

Open
jondkelley opened this issue Aug 24, 2018 · 2 comments
Open

This library no longer works on python 2.7 #129

jondkelley opened this issue Aug 24, 2018 · 2 comments

Comments

@jondkelley
Copy link

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

@jondkelley
Copy link
Author

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')

@castrapel
Copy link

castrapel commented Sep 14, 2018

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants