websockets giving problem

chandankr@yahoo.com
I am suddenly getting this error.

kws = WebSocket(apikey, token, userid)

File "/home/ck/anaconda2/lib/python2.7/site-packages/kiteconnect/__init__.py", line 694, in __init__
elif "csv" in r.headers["content-type"]:

File "/home/ck/anaconda2/lib/python2.7/site-packages/kiteconnect/__init__.py", line 708, in _create_connection
from kiteconnect import WebSocket

AttributeError: 'module' object has no attribute 'WebSocketApp'

-------
code is pretty simple
from kiteconnect import WebSocket

kws = WebSocket(api_key, access_token, user_id)
# Callback for tick reception.
def on_tick(tick, ws):
print tick

# Callback for successful connection.
def on_connect(ws):
# 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])

# Assign the callbacks.
kws.on_tick = on_tick
kws.on_connect = on_connect

# To enable auto reconnect WebSocket connection in case of network failure
# - First param is interval between reconnection attempts in seconds.
# Callback `on_reconnect` is triggered on every reconnection attempt. (Default interval is 5 seconds)
# - Second param is maximum number of retries before the program exits triggering `on_noreconnect` calback. (Defaults to 50 attempts)
# Note that you can also enable auto reconnection while initialising websocket.
# Example `kws = WebSocket("your_api_key", "your_public_token", "logged_in_user_id", reconnect=True, reconnect_interval=5, reconnect_tries=50)`
kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)

# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
kws.connect()
Sign In or Register to comment.