☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
14K
All Categories
0
Incidents
156
Node JS client
40
Go client
794
.Net API client
383
Kite Publisher
537
.Net / VBA / Excel (3rd party)
460
Algorithms and Strategies
1K
Java client
1.1K
API clients
404
PHP client
4K
Python client
348
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.4K
General
In this Discussion
May 2018
alphamurho
May 2018
sujith
WebSocket Connection Error
alphamurho
May 2018
in
Python client
Im getting the following error when I try to connect to KiteTicker..
Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403)
Found a similar post but that was a little different then what Im facing.
Tagged:
WebSocket Error
sujith
May 2018
It means authentication is failing. It means either you are passing an invalid access token or api_key.
alphamurho
May 2018
edited May 2018
Not sure if that is the reason.. Have the following code:
API_KEY = 'xxxx'
REQUEST_TOKEN = 'yyy'
API_SECRET = 'zzz'
kite = KiteConnect(api_key=API_KEY)
kws = KiteTicker(API_KEY, REQUEST_TOKEN)
data = kite.generate_session(REQUEST_TOKEN, api_secret = API_SECRET )
# THIS IS WORKING:
all_instruments = kite.instruments(exchange = kite.EXCHANGE_NFO)
# Assign the callbacks
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
# THIS THROWS ERROR
kws.connect()
alphamurho
May 2018
edited May 2018
My bad. I didn't know access token and request token were different
Can close
This discussion has been closed.
API_KEY = 'xxxx'
REQUEST_TOKEN = 'yyy'
API_SECRET = 'zzz'
kite = KiteConnect(api_key=API_KEY)
kws = KiteTicker(API_KEY, REQUEST_TOKEN)
data = kite.generate_session(REQUEST_TOKEN, api_secret = API_SECRET )
# THIS IS WORKING:
all_instruments = kite.instruments(exchange = kite.EXCHANGE_NFO)
# Assign the callbacks
kws.on_ticks = on_ticks
kws.on_connect = on_connect
kws.on_close = on_close
# THIS THROWS ERROR
kws.connect()
Can close