datacenter / acitoolkit

A basic toolkit for accessing the Cisco APIC
Other
350 stars 266 forks source link

Invalid scheme on APIC websocket refresh #343

Closed sigurd120 closed 5 years ago

sigurd120 commented 5 years ago

I'm using acitoolkit to set up a Websocket subscription on the Cisco sandboxapicdc. Initially, everything works great, and I get updates when anything changes on the APIC. However, when the subscription is about to refresh (after about a minute), I get the exception below. I'm running the code in this file on Github. It seems as if acitoolkit attempts to open a websocket with the https prefix.

Listening for Events...

WARNING:root:Websocket not established on subscription refresh. Re-establishing websocket
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/home/siggen/Projects/aci-learning-labs-code-samples/acitoolkit/acitoolkit/acisession.py", line 441, in run
    self.refresh_subscriptions()
  File "/home/siggen/Projects/aci-learning-labs-code-samples/acitoolkit/acitoolkit/acisession.py", line 250, in refresh_subscriptions
    self._open_web_socket('https://' in subscription)
  File "/home/siggen/Projects/aci-learning-labs-code-samples/acitoolkit/acitoolkit/acisession.py", line 288, in _open_web_socket
    self._ws = create_connection(self._ws_url, sslopt=sslopt, **kwargs)
  File "/home/siggen/Projects/aci-learning-labs-code-samples/venv/local/lib/python2.7/site-packages/websocket/_core.py", line 514, in create_connection
    websock.connect(url, **options)
  File "/home/siggen/Projects/aci-learning-labs-code-samples/venv/local/lib/python2.7/site-packages/websocket/_core.py", line 232, in connect
    options.pop('socket', None))
  File "/home/siggen/Projects/aci-learning-labs-code-samples/venv/local/lib/python2.7/site-packages/websocket/_http.py", line 107, in connect
    hostname, port, resource, is_secure = parse_url(url)
  File "/home/siggen/Projects/aci-learning-labs-code-samples/venv/local/lib/python2.7/site-packages/websocket/_url.py", line 63, in parse_url
    raise ValueError("scheme %s is invalid" % scheme)
ValueError: scheme https is invalid