Getting error while connecting websocket

ksmaheshkumar
Hi,


I am getting "ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))" error while trying to get the ticks.

My code is

from kiteconnect import KiteTicker
import logging

logging.basicConfig(level=logging.DEBUG)
api_key="api"
access_token="token"
tokens=[14668802]
kws=KiteTicker(api_key,access_token)
def on_ticks(ws,ticks):
for tick in ticks:
print('last_price',tick['last_price'],'date',tick['timestamp'])


def on_connect(ws,response):
ws.subscribe(tokens)
ws.set_mode(ws.MODE_FULL,tokens)

kws.on_ticks=on_ticks
kws.on_connect=on_connect
kws.connect()


I tried multiple times with different access token, still same error.

Would be great if anyone of you share the working code or correct the mistake in the code.

Thanks
Mahesh
This discussion has been closed.