After all reconnect attempts fail

vijoeyz
When on_noreconnect() gets invoked, it means all the reconnections attempts have failed (may be because network could not come back up). What is the suggested way of reconnecting?

1. Perform user login flow again ?
2. Or, simply do a KiteTicker() followed by ws.connect() again? (because access token remains valid)
  • MAG
    Login flow i.e. data = kite.generate_session("request_token_here", secret="your_secret")needs to happen just once a day in order to generate the access token. Once the access token is generated you can save it.
    And then you just need to initiate the kite authentication to create a connection object and then continue with whatever code you want to execute.
    In this case if you look at the example code at https://github.com/zerodha/pykiteconnect/blob/master/examples/ticker.py, you would start with kws = KiteTicker("your_api_key", "your_access_token")

    The data = kite.generate_session("request_token_here", secret="your_secret") call should not be run again and again.
Sign In or Register to comment.