ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly

mld
Hi Team,

I am new to Python client for the Kite Connect trading API. I am using Ubuntu 14.04 LTS.

Installed Python client using pip install kiteconnect --upgrade --pre

pip show kiteconnect showing kiteconnect version 3.7.0b5

Today I ran the the official example (from github) of how to run KiteTicker in threaded mode through terminal.
For the first run it produced desired output. But I terminated the program using Ctrl + C.
After that whenever I am trying to run the official example, I am getting the following error:

INFO:root:This is main thread. Will change webosocket mode every 5 seconds.
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
INFO:root:Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))
INFO:root:Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))

How to correct it and what is the correct way of closing the websocket connection cleanly?


  • sujith
    You need a valid access token to connect to Kite Ticker. It seems like you are not passing a valid api key or access token.
  • tanigai
    facing similar problem
    ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (403 - Forbidden))


    even though i gave valid api key and access token
  • sujith
    @tanigai,
    The new Kite Ticker expects valid credentials for connecting to the ticker. If you see 403 then it means either api_key is invalid or access token is invalid.
  • rvsw
    Hello

    I'm having a similar problem. I'm using the code that is provided at this link:https://kite.trade/docs/pykiteconnect/v3/

    I'm using the code to read the prices with the live streaming during market hours. While the order placement is possible, I'm unable to read the prices.

    One of the differences I see between the two codes is that for live streaming, there is no place to provide the API secret. With the kite ticker, one can provide the API key as well is the session but there is no place to provide the API secret.

    I'm using the version 3 and the date today is June 28, 2018
  • TUSH123
    same issue I am facing after upgrading to Kiteconnect latest api version

    ticker:Connection error: 1006 - connection was closed uncleanly
  • rakeshr
    @TUSH123
    Can you go through this thread?
    Make sure, there is no assignment related error on_tick method.
  • Kartikey
    I am getting same error , How to resolve this . I am using valid API key and Token
Sign In or Register to comment.