502 Bad Gateway

Arham
Arham edited November 2021 in API clients


Unknown Content-Type (text/html) with response: (b'\r\n502 Bad Gateway\r\n\r\n

502 Bad Gateway

\r\n\r\n\r\n') .

While fetching 15 Min Historic data from Kite I am getting this error repeatedly. Can someone please figure out what's happening?.
  • rakeshr
    Are you trying to fetch live candle data?
    Do let us know all request query params, like instrument token, period (to and from), candle interval.
  • Arham
    Yes, I am trying to fetch Live Candle Data.
    I am using following API's
    1) kite.instuments()
    2)kite.instruments(exchange=kite.EXCHANGE_NFO)
    3) kite.historical_data(instument_token of all NIFTY 500 Symbols ,'2018-03-01', YESTERDAYS DATE TIME,'DAY')
    4) kite.historical_data(instument_token of all NIFTY 500 Symbols ,25 DAYS BEFORE TODAYS DATE, TODAYS DATE TIME,'15MINS')

    I am able to fetch data sometimes it gives the response and sometimes it shows critical error . 'Unknown Content-Type (text/html) with response: (b'\r\n502 Bad Gateway\r\n\r\n'). My python exceptions are not able to handle it.
  • rakeshr
    kite.historical_data(instument_token of all NIFTY 500 Symbols ,25 DAYS BEFORE TODAYS DATE, TODAYS DATE TIME,'15MINS')
    Live candle fetch is not recommended. You need to form candles at your ending, using WebSocket streaming. This thread explains more.
Sign In or Register to comment.