alvarobartt / investpy

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

JSON error trying to obtain data from investpy #616

Open davidpazo opened 1 year ago

davidpazo commented 1 year ago

Hi! I am trying to use investpy to obtain news in my channel. Two days ago this work perfectly but since then i have this error:

Traceback (most recent call last): File "C:\Users\Usuario\PycharmProjects\test-investpy.py", line 7, in <module> data = investpy.economic_calendar(countries=countries, importances=importance) File "C:\Users\Usuario\AppData\Local\Programs\Python\Python310\lib\site-packages\investpy\news.py", line 251, in economic_calendar root = fromstring(req.json()["data"]) File "C:\Users\Usuario\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "C:\Users\Usuario\AppData\Local\Programs\Python\Python310\Lib\json\__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\Users\Usuario\AppData\Local\Programs\Python\Python310\Lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\Usuario\AppData\Local\Programs\Python\Python310\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)

My code is:

`import investpy as investpy import pandas as pd

countries = ['united states', "united kingdom"] importance = ['high', 'medium']

data = investpy.economic_calendar(countries=countries, importances=importance) data.head() print(data)`

jazz-g commented 1 year ago

Getting the same issue, I'm guessing investing.com changed something which caused the scraper to break.

jazz-g commented 1 year ago

yeah it's a 403 error, and it looks like investing.com doesn't want these libraries to work. The chance of this library working again doesn't look good.

beinghorizontal commented 1 year ago

I'm getting the same 403 error. I tried to update the headers as shown in Chrome >>inspect>>network tab but nothing works. I even copy-pasted the cookies but to no avail. By the way, this issue is a duplicate of issue 615 link For the solution check this Reply

ngeorgj commented 1 year ago

@alvarobartt do you know if this data scrapping can be fixed? (not trying to push you guys on fixing, just to understand if this can be fixed), I kinda used the library a lot, this is affecting my research.

agftrading commented 1 year ago

@alvarobartt do you know if this data scrapping can be fixed? (not trying to push you guys on fixing, just to understand if this can be fixed), I kinda used the library a lot, this is affecting my research.

Same same