Service Unavailable Error

balajibetadur
I am getting an error when I try to fetch quote data saying 'Couldn't parse the JSON response received from the server: b'
503 Service Unavailable
\nNo server is available to handle this request.\n\n''. Please help me sort this issue.
  • jits_1998
    all my clients got this while fetching the quote today morning. What is the recommended way to handle it?
    File "/home/algotrader/venv/lib/python3.8/site-packages/kiteconnect/connect.py", line 851, in _get
    return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
    File "/home/algotrader/venv/lib/python3.8/site-packages/kiteconnect/connect.py", line 916, in _request
    raise ex.DataException("Couldn't parse the JSON response received from the server: {content}".format(
    kiteconnect.exceptions.DataException: Couldn't parse the JSON response received from the server: b'<html><body><h1>503 Service Unavailable</h1>\nNo server is available to handle this request.\n</body></html>\n'
  • jits_1998
    according to code, it should be raising ex.NetworkException (503), but the return type is marked as json, hence the incorrect exception (502).

    Please suggest how to handle it.
  • sujith
    You will have to catch the exception and retry after a small delay.
Sign In or Register to comment.