I just ran the sample code present on https://github.com/Sharekhan-API/shareconnectpython.
On running that, got this error:
Traceback (most recent call last):
File "test.py", line 46, in
sws.connect()
File ".venv\Lib\site-packages\SharekhanApi\sharekhanWebsocket.py", line 100, in connect
raise e
File ".venv\Lib\site-packages\SharekhanApi\sharekhanWebsocket.py", line 94, in connect
self.wsapp = websocket.WebSocketApp(self.root, header=headers, on_open=self._on_open,
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'websocket' has no attribute 'WebSocketApp'. Did you mean: 'WebSocket'?
Code is included below.
from SharekhanApi.sharekhanWebsocket import SharekhanWebSocket
access_token = "....."
action = 1
mode = 1
token_list = {"action": "subscribe", "key": ["feed"], "value": [""]}
feed = {"action": "feed", "key": ["depth"], "value": ["MX250715"]}
unsubscribefeed = {"action":"unsubscribe","key":["feed"],"value":["NC22,NF37833,NF37834,MX253461,RN7719"]}
sws = SharekhanWebSocket(access_token)
def on_data(wsapp, message):
print("Ticks: {}".format(message))
def on_open(wsapp):
print("on open")
sws.subscribe(token_list)
# sws.fetchData(feed)
# sws.unsubscribe(unsubscribefeed)
# sws.close_connection()
def on_error(wsapp, error):
print(error)
def on_close(wsapp):
print("Close")
# Assign the callbacks.
sws.on_open = on_open
sws.on_data = on_data
sws.on_error = on_error
sws.on_close = on_close
sws.connect()
I just ran the sample code present on https://github.com/Sharekhan-API/shareconnectpython.
On running that, got this error:
Traceback (most recent call last):
File "test.py", line 46, in
sws.connect()
File ".venv\Lib\site-packages\SharekhanApi\sharekhanWebsocket.py", line 100, in connect
raise e
File ".venv\Lib\site-packages\SharekhanApi\sharekhanWebsocket.py", line 94, in connect
self.wsapp = websocket.WebSocketApp(self.root, header=headers, on_open=self._on_open,
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'websocket' has no attribute 'WebSocketApp'. Did you mean: 'WebSocket'?
Code is included below.