alvarobartt / investpy

Financial Data Extraction from Investing.com with Python
https://investpy.readthedocs.io/
MIT License
1.59k stars 375 forks source link

investpy.news.economic_calendar throw simplejson.errors.JSONDecodeError #324

Closed Daywalker7754 closed 3 years ago

Daywalker7754 commented 3 years ago

a direct call of investpy.news.economic_calendar() does not work any longer. Since yesterday it throws the following error:

File "***\site-packages\investpy\news.py", line 207, in economic_calendar
    root = fromstring(req.json()['data'])
  File "***\site-packages\requests\models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "***\site-packages\simplejson\__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "***\site-packages\simplejson\decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "***\site-packages\simplejson\decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
  File "***\site-packages\simplejson\scanner.py", line 79, in scan_once
    return _scan_once(string, idx)
  File "***\site-packages\simplejson\scanner.py", line 70, in _scan_once
    raise JSONDecodeError(errmsg, string, idx)
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Every test with different parameter, like countries, importance, start and end dates led to the same issue. Until yesterday everything worked pretty well.

Daywalker7754 commented 3 years ago

Found the issue. I installed now the package "brotli" as it seems that this is neccessary to read the new export from investing.com, this resolved my issue

alvarobartt commented 3 years ago

You can install the new-fixed version as it follows:

pip install investpy==1.0.5

Sorry for the inconvenience, seems that Investing.com is applying a lot of changes and under maintenance... Everyone thank both @danilogalisteu and @nhlsm for their awesome support! 👍🏻

alvarobartt commented 3 years ago

Feel free to drop some comments here https://github.com/alvarobartt/investpy/discussions/334 and more information if applicable, such as the IDs of the solved issues and so on, so that I can include all the information into the Release Notes! :hugs: Thank you!