Python: kiteconnect.exceptions.DataException: Unknown Content-Type (text/plain; charset=utf-8) with

thiyagaraaj
I get this error mostly between 10AM to 3:30 PM. I am trying to fetch the margin details through my python code:
margin_detail = kite.order_margins(order_param)
<<<
since i have 1000 records to get the margin details, I pass every 200 in order_param for 5 times in loop (since maximum allowed request is around 218). When I run this code, I get the following error

Traceback (most recent call last):
File "C:/Users/thiyagu/PycharmProjects/pythonProject/Research/fno_kiteMargin.py", line 75, in <module>
margin_detail = kite.order_margins(order_param)
File "C:\Users\thiyagu\PycharmProjects\pythonProject\venv\lib\site-packages\kiteconnect\connect.py", line 765, in order_margins
return self._post("order.margins", params=params, is_json=True)
File "C:\Users\thiyagu\PycharmProjects\pythonProject\venv\lib\site-packages\kiteconnect\connect.py", line 841, in _post
return self._request(route, "POST", url_args=url_args, params=params, is_json=is_json, query_params=query_params)
File "C:\Users\thiyagu\PycharmProjects\pythonProject\venv\lib\site-packages\kiteconnect\connect.py", line 919, in _request
raise ex.DataException("Unknown Content-Type ({content_type}) with response: ({content})".format(
kiteconnect.exceptions.DataException: Unknown Content-Type (text/plain; charset=utf-8) with response: (b'Error when parsing request')

>>>

The same code works fine without any issues after 3:30 or 4 PM or in weekends.

Please suggest any resolution.

Regards,
Thiyagu
This discussion has been closed.