What exception is raised when an API limit is reached?

aayusss2101
I am using the python client to write code to execute orders. As the code is running a lot of things in parallel there might be some scenarios where an API limit of 10 requests/second is reached. How is this information passed on through exceptions so that I can handle them in my code?
Tagged:
  • ANL
    Using the exception method, when your API limit exceeds it will hit the exception with 429: Too many requests to the API (rate limiting)

    Go through : Exceptions and Errors

    You can get API limits by doing different approaches so that you can avoid hitting API limits.
  • aayusss2101
    which type of Exception object will it be? For example, NetworkException, OrderException, etc
  • ANL
    If you use the API for order placement and the limit is exceeded, you will get an order placement error, which is listed in the exceptions and errors. Check common HTTP error codes and exception types. Read the documentation carefully.
  • aayusss2101
    I am not directly calling the REST API, rather going through functions provided by the pykiteconnect library. I don't think I will receive the HTTP error code 429 in this case if api limit has been breached, so my question is very simple, how is this information passed onto me in the pykiteconnect setup?
  • rakeshr
    How is this information passed on through exceptions so that I can handle them in my code?
    It will come as a NetworkException.
  • aayusss2101
    will it have the status code 429 in the exception message? or is there any other way I can distinguish it from a normal NetworkException which might arise due to network issues?
  • rakeshr
    will it have the status code 429 in the exception message?
    Yes. The error message will also have the above text.
Sign In or Register to comment.