Exception While calling LTP

ATH
Hello Traders

Getting Error while calling ltp, can anyone help me with below points

1) Why the below error is coming
2) How to Handle it



Current Time : 2022-09-15 12:31:59.312062
Traceback (most recent call last):
File "algo_vikas.py", line 429, in
ltp_index = kite.ltp('NFO'+':'+fut_name)['NFO'+':'+fut_name]['last_price']
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\kiteconnect\connect.py", line 606, in ltp
return self._get("market.quote.ltp", params={"i": ins})
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\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 "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\kiteconnect\connect.py", line 926, in _request
content=r.content))
kiteconnect.exceptions.DataException: Unknown Content-Type (text/html; charset=UTF-8) with response: (b'<!DOCTYPE html>\n\n\n\n \n\n\n\napi.kite.trade | 520: Web server is returning an unknown error\n\n\n\n\n\n\n\n\n\n\n
\n\n \n\n
\n \n

\n \n Web server is returning an unknown error\n Error code 520\n

\n
\n Visit cloudflare.com for more information.\n
\n
2022-09-15 07:01:59 UTC
\n \n \n
\n
\n
\n \n
\n
\n \n \n \n \n
\n You\n

\n \n Browser\n \n

\n Working\n
\n\n
\n
\n \n \n \n \n
\n Mumbai\n

\n \n Cloudflare\n \n

\n Working\n
\n\n
\n
\n \n \n \n \n
\n api.kite.trade\n

\n \n Host\n \n

\n Error\n
\n\n
\n \n
\n
\n\n
\n
\n
\n

What happened?

\n

There is an unknown connection issue between Cloudflare and the origin web server. As a result, the web page can not be displayed.

\n
\n \n
\n

What can I do?

\n

If you are a visitor of this website:

\n

Please try again in a few minutes.

\n\n

If you are the owner of this website:

\n

There is an issue between Cloudflare\'s cache and your origin web server. Cloudflare monitors for these errors and automatically investigates the cause. To help support the investigation, you can pull the corresponding error log from your web server and submit it our support team. Please include the Ray ID (which is at the bottom of this error page). Additional troubleshooting resources.

\n
\n
\n \n
\n\n
\n

\n Cloudflare Ray ID: 74af7e85dc5f6ed4\n •\n \n Your IP:\n Click to reveal\n 2406:da1a:137:c000:1366:dbac:5fe8:6562\n •\n \n Performance & security by Cloudflare\n \n

\n (function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&&(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})();\n
\n\n\n
\n
\n\n\n\n')
Tagged:
  • rakeshr
    Web server is returning an unknown error Error code 520
    Are you getting this exception continuously? How many symbols you are requesting for LTP fetch?
  • ATH
    only 4 symbols,
    fetching ltp after 0.2 second of sleep, every time
  • sujith
    You might be getting rate limited. You can know more about API rate limits from the FAQs.
Sign In or Register to comment.