Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 3413, in _connectionMade self.startHandshake() File "/usr/local/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 3566, in startHandshake txaio.add_callbacks(options_d, got_options, options_failed) File "/usr/local/lib/python3.6/site-packages/txaio/tx.py", line 443, in add_callbacks future.addCallbacks(callback, errback) File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 330, in addCallbacks self._runCallbacks() --- --- File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 662, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/usr/local/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 3556, in got_options self._actuallyStartHandshake(request_options) File "/usr/local/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 3638, in _actuallyStartHandshake self.sendData(self.http_request_data) File "/usr/local/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 1336, in sendData self.transport.write(data) File "/usr/local/lib/python3.6/site-packages/twisted/protocols/tls.py", line 454, in write self._write(bytes) File "/usr/local/lib/python3.6/site-packages/twisted/protocols/tls.py", line 513, in _write sent = self._tlsConnection.send(toSend) File "/usr/local/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1644, in send with _from_buffer(buf) as data: builtins.AttributeError: __enter__
Unhandled Error Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/twisted/python/log.py", line 101, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "/usr/local/lib/python3.6/site-packages/twisted/python/log.py", line 85, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/usr/local/lib/python3.6/site-packages/twisted/python/context.py", line 118, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/usr/local/lib/python3.6/site-packages/twisted/python/context.py", line 83, in callWithContext return func(*args, **kw) --- --- File "/usr/local/lib/python3.6/site-packages/twisted/internet/posixbase.py", line 687, in _doReadOrWrite why = selectable.doRead() File "/usr/local/lib/python3.6/site-packages/twisted/internet/tcp.py", line 246, in doRead return self._dataReceived(data) File "/usr/local/lib/python3.6/site-packages/twisted/internet/tcp.py", line 251, in _dataReceived rval = self.protocol.dataReceived(data) File "/usr/local/lib/python3.6/site-packages/twisted/protocols/tls.py", line 304, in dataReceived self._tlsConnection.bio_write(bytes) File "/usr/local/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1801, in bio_write with _from_buffer(buf) as data: builtins.AttributeError: __enter__
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake) ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
I am trying to run sample code given in docs . Kite APIs are working fine on the same environment ... Here I give the sample code which I am trying to run ... ---------------------------------------
def on_ticks(ws, ticks): # Callback to receive ticks. logging.debug("Ticks: {}".format(ticks))
def on_connect(ws, response): # Callback on successful connect. # Subscribe to a list of instrument_tokens (RELIANCE and ACC here). ws.subscribe([738561, 5633])
# Set RELIANCE to tick in `full` mode. ws.set_mode(ws.MODE_FULL, [738561])
def on_close(ws, code, reason): # On connection close stop the main loop # Reconnection will not happen after executing `ws.stop()` ws.stop()