Do we get exceptions in Python client if we call unsubscribe multiple times on the same tokens?
Here is what we received
Dec 01 22:25:13 2020-12-02 06:25:13,506 - positionManager - MainThread - WARNING - No data found for 9266178 in local cache. Checking if position got closed as result of adjustment or SL Dec 01 22:25:13 2020-12-02 06:25:13,506 - positionManager - MainThread - INFO - Position for 29700 CE got closed as result of adjustment or SL Dec 01 22:25:13 2020-12-02 06:25:13,506 - positionManager - MainThread - INFO - Unsubscribing ticks for 29700 CE Dec 01 22:25:13 Unhandled Error Dec 01 22:25:13 Traceback (most recent call last): Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger Dec 01 22:25:13 return callWithContext({"system": lp}, func, *args, **kw) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext Dec 01 22:25:13 return context.call({ILogContext: newCtx}, func, *args, **kw) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext Dec 01 22:25:13 return self.currentContext().callWithContext(ctx, func, *args, **kw) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext Dec 01 22:25:13 return func(*args,**kw) Dec 01 22:25:13 --- --- Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite Dec 01 22:25:13 why = selectable.doRead() Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/internet/tcp.py", line 243, in doRead Dec 01 22:25:13 return self._dataReceived(data) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/internet/tcp.py", line 249, in _dataReceived Dec 01 22:25:13 rval = self.protocol.dataReceived(data) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/protocols/tls.py", line 330, in dataReceived Dec 01 22:25:13 self._flushReceiveBIO() Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/protocols/tls.py", line 295, in _flushReceiveBIO Dec 01 22:25:13 ProtocolWrapper.dataReceived(self, bytes) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/twisted/protocols/policies.py", line 120, in dataReceived Dec 01 22:25:13 self.wrappedProtocol.dataReceived(data) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/autobahn/twisted/websocket.py", line 290, in dataReceived Dec 01 22:25:13 self._dataReceived(data) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 1206, in _dataReceived Dec 01 22:25:13 self.consumeData() Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 1218, in consumeData Dec 01 22:25:13 while self.processData() and self.state != WebSocketProtocol.STATE_CLOSED: Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 1578, in processData Dec 01 22:25:13 fr = self.onFrameEnd() Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 1703, in onFrameEnd Dec 01 22:25:13 self._onMessageEnd() Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/autobahn/twisted/websocket.py", line 318, in _onMessageEnd Dec 01 22:25:13 self.onMessageEnd() Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/autobahn/websocket/protocol.py", line 627, in onMessageEnd Dec 01 22:25:13 self._onMessage(payload, self.message_is_binary) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/autobahn/twisted/websocket.py", line 321, in _onMessage Dec 01 22:25:13 self.onMessage(payload, isBinary) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/kiteconnect/ticker.py", line 71, in onMessage Dec 01 22:25:13 self.factory.on_message(self, payload, is_binary) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/kiteconnect/ticker.py", line 670, in _on_message Dec 01 22:25:13 self.on_ticks(self, self._parse_binary(payload)) Dec 01 22:25:13 File "/app/positionManager.py", line 535, in kiteTickerOnTicks Dec 01 22:25:13 if (not self.isMissingInstTokenInClosedPositions(tick['instrument_token'])): Dec 01 22:25:13 File "/app/positionManager.py", line 467, in isMissingInstTokenInClosedPositions Dec 01 22:25:13 self.kiteTicker.unsubscribe([instrumentToken]) Dec 01 22:25:13 File "/app/.heroku/python/lib/python3.6/site-packages/kiteconnect/ticker.py", line 588, in unsubscribe Dec 01 22:25:13 self.ws.sendMessage( Dec 01 22:25:13 builtins.AttributeError: 'NoneType' object has no attribute 'sendMessage' Dec 01 22:25:13 2020-12-02 06:25:13,519 - positionManager - MainThread - ERROR - Error in Kite Ticker. Code : 1006 : Reason : connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake) Dec 01 22:25:13 2020-12-02 06:25:13,519 - positionManager - MainThread - ERROR - Connection to Kite Ticker Closed. Code : 1006 : Reason : connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake) Dec 01 22:25:14 Process exited with status 0
Do we get exceptions in Python client if we call unsubscribe multiple times on the same tokens?
Yes, it will throw an exception with the message "Error while unsubscribe: {}".format(str(e)). You can refer unsubscribe exception part of the code here.
"Error while unsubscribe: {}".format(str(e))
. You can refer unsubscribe exception part of the code here.