Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON error trying to obtain data from investpy #616

Open
davidpazo opened this issue Oct 21, 2022 · 5 comments
Open

JSON error trying to obtain data from investpy #616

davidpazo opened this issue Oct 21, 2022 · 5 comments

Comments

@davidpazo
Copy link

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
Copy link

jazz-g commented Oct 22, 2022

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

@jazz-g
Copy link

jazz-g commented Oct 22, 2022

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
Copy link

beinghorizontal commented Oct 31, 2022

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
Copy link

ngeorgj commented Nov 18, 2022

@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
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants