Couldn't parse the JSON response received from the server

navin25
Following error was encountered today around 11.30am. Why? Any update in the code? Server issue?
```
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.10/site-packages/kiteconnect/connect.py", line 905, in _request
data = json.loads(r.content.decode("utf8"))
File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
.
.
.
.
m_ltp = kite.ltp(m_instru)
File "/home/ubuntu/.local/lib/python3.10/site-packages/kiteconnect/connect.py", line 606, in ltp
return self._get("market.quote.ltp", params={"i": ins})
File "/home/ubuntu/.local/lib/python3.10/site-packages/kiteconnect/connect.py", line 842, in _get
return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
File "/home/ubuntu/.local/lib/python3.10/site-packages/kiteconnect/connect.py", line 907, 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'

503 Service Unavailable

\nNo server is available to handle this request.\n\n'
```
Tagged:
  • sujith
    There was an internal DNS issue which got fixed.
  • bharathks
    Mr.Sujith, I am not able to connect to kite API. what should be the redirect url and what should be the totp xpath. Please suggest sir.

    redirect url I am currently mentioned trade kite portal is : https://zerodha.com

    AND
    # print(authkey, authkey.now())
    totp.send_keys(authkey.now())
    continue_btn = WebDriverWait(driver, 10).until(lambda x: x.find_element
    ("xpath", '//*[@id="container"]/div/div/div[2]/form/div[3]/button'))
  • bharathks
    further, I am getting the below error messages on my telegram bot because of API issue.

    algobuy, [20-03-2023 18:12]
    2023-03-20 18:12:07:Bank Nifty Zerodha handle failure Incorrect api_key or access_token..


    algobuy, [20-03-2023 18:12]
    2023-03-20 18:12:09:Bank Nifty CloseOrder - Incorrect api_key or access_token.
  • rakeshr
    what should be the totp xpath
    Automation of login flow is not recommended by the exchange. Go through the login FAQs here.
This discussion has been closed.