barchart-ondemand-client-python icon indicating copy to clipboard operation
barchart-ondemand-client-python copied to clipboard

JSON decode Error

Open nectario opened this issue 5 years ago • 1 comments

When I call: result = ondemand.history("AAPL", "minutes", interval=60, maxRecords=100)

I am getting this error:

`Barchart OnDemand Client: https://ondemand.websol.barchart.com/service?wsdl Traceback (most recent call last): File "C:\Development\Python\Python376\lib\site-packages\ondemand\ondemand_client.py", line 58, in do_call result = resp.json() File "C:\Development\Python\Python376\lib\site-packages\requests\models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "C:\Development\Python\Python376\lib\json_init.py", line 348, in loads return _default_decoder.decode(s) File "C:\Development\Python\Python376\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Development\Python\Python376\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:/Development/Projects/DeepTradingAI/DJIAHistorical.py", line 57, in data = djia_historical.get_historical_stock_prices("AAPL") File "C:/Development/Projects/DeepTradingAI/DJIAHistorical.py", line 17, in get_historical_stock_prices result = ondemand.history("AAPL", "minutes", interval=60, maxRecords=1000) File "C:\Development\Python\Python376\lib\site-packages\ondemand\ondemand_client.py", line 121, in history return self._do_call(self.endpoint + 'getHistory.json', kwargs) File "C:\Development\Python\Python376\lib\site-packages\ondemand\ondemand_client.py", line 61, in _do_call 'Failed to parse JSON response %s. Resp Code: %s. Text: %s' % (e, resp.status_code, resp.text)) ondemand.ondemand_client.OnDemandError: Failed to parse JSON response Expecting value: line 1 column 1 (char 0). Resp Code: 200. Text: `

nectario avatar Mar 03 '20 02:03 nectario

sorry for the late reply @nectario

the proper end_point is: https://ondemand.websol.barchart.com/ or for the free/sandbox api it's: https://marketdata.websol.barchart.com/

mvberg avatar Nov 07 '20 23:11 mvberg