"Couldn't parse the JSON response received from the server: b''"


  • "[I 250311 11:17:55 login:27] ✅ Login Successful!
    [I 250311 11:17:55 fetch_data_gui:61] 📡 Sending Historical Data Request: {'exchange': 'NSE', 'symboltoken': '3045', 'interval': 'DAY', 'fromdate': '2025-03-04 00:00', 'todate': '2025-03-05 23:59'}
    [E 250311 11:17:55 fetch_data_gui:79] Fetching historical data failed: Couldn't parse the JSON response received from the server: b''
    Traceback (most recent call last):
    File "C:\Users\user\projects\angelalgo\venv\Lib\site-packages\SmartApi\smartConnect.py", line 227, in request
    data = json.loads(r.content.decode("utf8"))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\json_init
    .py", line 346, in loads
    return _default_decoder.decode(s)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\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):
      File "C:\Users\user\projects\angelalgo\smartapi\fetch_data_gui.py", line 64, in fetch_historical_data
        historical_data = smart_api.getCandleData(historic_params)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\user\projects\angelalgo\venv\Lib\site-packages\SmartApi\smartConnect.py", line 462, in getCandleData
        getCandleDataResponse=self._postRequest("api.candle.data",historicDataParams)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\user\projects\angelalgo\venv\Lib\site-packages\SmartApi\smartConnect.py", line 260, in _postRequest
        return self._request(route, "POST", params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    

    Couldn't parse the JSON response received from the server: b''"


  • @H53749929 request you to take help from the users on the forum or through freelance programmers for the same.

    The API is working fine.