Unable to generate session token

gtskaushik
Hi Team
I'm unable to generate session token. The same code has been running on AWS cloud for more than 3 months. It started failing suddenly. Whereas if I use the same generateSession method in my laptop using the same ApiKey, SecretKey and RequestToken it works.

One thing the highlight is that the AWS server is provisioned in US region. Was there any new restriction added today or yesterday?

This is the stacktrace
com.zerodhatech.kiteconnect.kitehttp.exceptions.NetworkException: null
at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.dealWithException(KiteResponseHandler.java:58) ~[kiteconnect-3.2.1.jar!/:na]
at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:20) ~[kiteconnect-3.2.1.jar!/:na]
at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.postRequest(KiteRequestHandler.java:86) ~[kiteconnect-3.2.1.jar!/:na]
at com.zerodhatech.kiteconnect.KiteConnect.generateSession(KiteConnect.java:189) ~[kiteconnect-3.2.1.jar!/:na]
at io.quantum.trading.brokers.zerodha.ZerodhaBroker.generateAccessToken(ZerodhaBroker.java:385) ~[core-0.0.1-SNAPSHOT.jar!/:0.0.1-SNAPSHOT]
  • gtskaushik
    I figured out the problem. I had 2 services running.
    1. One was supposed to handle login redirect request
    2. The other will poll data from Kite apis (This was in constant retry)
    Since the 2nd service was retrying continuously when the login was not complete, I was getting too many requests error. I figured this out when I issued a curl command in my server. I would have been nice if the Java SDK gave this information in the stacktrace.

    The solution was to stop the 2nd service and then do login after 5-10 secs. Then start the 2nd service. Hope this helps someone
  • naveen278
    You can sleep for 55 milliseconds also so the number of requests reduces.


    try
    {
    Thread.sleep(55);

    }
    catch (InterruptedException e)
    {

    e.printStackTrace();

    }
Sign In or Register to comment.