I am getting following error intermittently today morning. Is there any issue with the server?
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'
i am facing same problem , according to AI ""The error message suggests that the JSON response received from the server could not be parsed, and a JSONDecodeError occurred. Additionally, the traceback shows that the initial error occurred in the _request method of the kiteconnect.connect module.
However, the second error message indicates that the server returned a 503 Service Unavailable error, which suggests that there might be an issue with the server and not necessarily with the code. This could be a temporary issue, and you may want to try running the code again later to see if the issue has been resolved.
If the issue persists, you may want to check the documentation for the kiteconnect package to ensure that you are using the correct methods and parameters. Additionally, you can try contacting the support team for the API or the server to see if they can provide any insights into the issue."" also "" the keys in the dictionary are using single quotes instead of double quotes, which is causing a syntax error when attempting to parse the dictionary as JSON.""
I am getting the same error intermittently, I don't understand if it is a Kite Issue or some code issue. The same piece of code has been working for a long time though.
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'
I am also getting this error every now and then since morning. one order got executed and the program exited when trying to execute another other at 9:40
Here is the log. Traceback (most recent call last): File "/home/ec2-user/.local/lib/python3.7/site-packages/kiteconnect/connect.py", line 900, in _request data = json.loads(r.content.decode("utf8")) File "/usr/lib64/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/usr/lib64/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib64/python3.7/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)
Have raised the same issue in the support portal - #20230318718552 – Kite API frequent errors Zerodha support team is in denial - they need more instances to raise the priority on this issue.
pl use the above ticket no as a reference and create your own ticket to raise the priority on this one.
Facing the same issue: Exception has occurred: 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' StopIteration: 0
During handling of the above exception, another exception occurred:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
File "C:\Work\PythonProjects\stockIVs.py", line 185, in fut_quote = kite.quote(tokenfut)[tokenfut] kiteconnect.exceptions.DataException: Couldn't parse the JSON response received from the server: b'
@rahilbhansali +1 on that Rahil - @sujith can Zerodha provide us with a real time view of the health of the APIs - we could atleast consolidate our positions and hold our algo/trades if we know that there are service isses wrt the API.
5% might be a small percentage, but it is not complete failure for 5% of customers - it is 5% of times (or less) for any customer. But since the error is intermittent - we cant take a call on whether to run the algo or not. Hope you understand.
This was misleading and we couldn't understand if it was the problem with server or with our scripts. The former possibility was high as the scripts worked fine until server started behaving erratically.
Is there any way to check Server Health? It would help us all i.e. those 5% affected, to take appropriate measure until such issue is resolved.
We understand that such issues may not be fixed as soon as they are reported, especially over the weekend and on Monday mornings before business hours. But I am sure you are aware about the extent of adverse financial implications such issues have.
@sujith - I am getting the same error today as well. (kiteconnect.exceptions.DataException: Couldn't parse the JSON response received from the server: b'). Please let me know when this issue will be addressed permanently. This is producing unwanted losses.
However, the second error message indicates that the server returned a 503 Service Unavailable error, which suggests that there might be an issue with the server and not necessarily with the code. This could be a temporary issue, and you may want to try running the code again later to see if the issue has been resolved.
If the issue persists, you may want to check the documentation for the kiteconnect package to ensure that you are using the correct methods and parameters. Additionally, you can try contacting the support team for the API or the server to see if they can provide any insights into the issue.""
also
"" the keys in the dictionary are using single quotes instead of double quotes, which is causing a syntax error when attempting to parse the dictionary as JSON.""
Was some service down? Has some rate limit changed?
Couldn't parse the JSON response received from the server: b'
503 Service Unavailable
\nNo server is available to handle this request.\n\nkite.ltp(ticker_symbol[i])[ticker_symbol[i]]["last_price"]
~\anaconda3\lib\site-packages\kiteconnect\connect.py in ltp(self, *instruments)
608 ins = instruments[0]
609
--> 610 return self._get("market.quote.ltp", params={"i": ins})
611
612 def historical_data(self, instrument_token, from_date, to_date, interval, continuous=False, oi=False):
~\anaconda3\lib\site-packages\kiteconnect\connect.py in _get(self, route, url_args, params, is_json)
849 def _get(self, route, url_args=None, params=None, is_json=False):
850 """Alias for sending a GET request."""
--> 851 return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
852
853 def _post(self, route, url_args=None, params=None, is_json=False, query_params=None):
~\anaconda3\lib\site-packages\kiteconnect\connect.py in _request(self, route, method, url_args, params, is_json, query_params)
914 data = r.json()
915 except ValueError:
--> 916 raise ex.DataException("Couldn't parse the JSON response received from the server: {content}".format(
917 content=r.content))
918
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'503 Service Unavailable
\nNo server is available to handle this request.\n\n'I am also getting this error every now and then since morning. one order got executed and the program exited when trying to execute another other at 9:40
Here is the log.
Traceback (most recent call last):
File "/home/ec2-user/.local/lib/python3.7/site-packages/kiteconnect/connect.py", line 900, in _request
data = json.loads(r.content.decode("utf8"))
File "/usr/lib64/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.7/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)
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'Zerodha support team is in denial - they need more instances to raise the priority on this issue.
pl use the above ticket no as a reference and create your own ticket to raise the priority on this one.
Man, this is killing me today.
Exception has occurred: 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'StopIteration: 0
During handling of the above exception, another exception occurred:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
File "C:\Work\PythonProjects\stockIVs.py", line 185, in
fut_quote = kite.quote(tokenfut)[tokenfut]
kiteconnect.exceptions.DataException: Couldn't parse the JSON response received from the server: b'
◐2023-03-20 13:19:00.703972
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 770, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 389, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 340, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/kiteconnect/connect.py", line 606, in ltp
return self._get("market.quote.ltp", params={"i": ins})
File "/usr/local/lib/python3.9/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 "/usr/local/lib/python3.9/site-packages/kiteconnect/connect.py", line 897, in _request
raise e
File "/usr/local/lib/python3.9/site-packages/kiteconnect/connect.py", line 885, in _request
r = self.reqsession.request(method,
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 578, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Exception:HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=7)
Exception:HTTPSConnectionPool(host='api.kite.trade', port=443): Read timed out. (read timeout=
Can this be handled a little more promptly next time / alert-driven? This has downstream impacts for all of us involved.
5% might be a small percentage, but it is not complete failure for 5% of customers - it is 5% of times (or less) for any customer. But since the error is intermittent - we cant take a call on whether to run the algo or not. Hope you understand.
Fetched above link from here: https://zerodha.com/marketintel/bulletin/325623/intermittent-connectivity-issue-on-kite
This was misleading and we couldn't understand if it was the problem with server or with our scripts. The former possibility was high as the scripts worked fine until server started behaving erratically.
Is there any way to check Server Health? It would help us all i.e. those 5% affected, to take appropriate measure until such issue is resolved.
We understand that such issues may not be fixed as soon as they are reported, especially over the weekend and on Monday mornings before business hours. But I am sure you are aware about the extent of adverse financial implications such issues have.