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

Expecting value: line 1 column 1 (char 0) #615

Open
normanvdmeijden opened this issue Oct 19, 2022 · 15 comments
Open

Expecting value: line 1 column 1 (char 0) #615

normanvdmeijden opened this issue Oct 19, 2022 · 15 comments

Comments

@normanvdmeijden
Copy link

Hi guys,

Yesterday I could retrieve the calender info with any issues, trying it this morning (same code), I received the following error below.
How can I fix this?

Traceback (most recent call last):
File "C:\Users\vanderMeijden\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\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\vanderMeijden\Desktop\EIA\EIACalender", line 28, in
calender = investpy.news.economic_calendar(from_date="19/10/2022", to_date="21/10/2022")
File "C:\Users\vanderMeijden\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\investpy\news.py", line 251, in economic_calendar
root = fromstring(req.json()["data"])
File "C:\Users\vanderMeijden\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Thanks,
Norman

@Lontaren
Copy link

I have the same problem

@brianchu1986
Copy link

same problem here, response 403 forbiden.

@varshasahasrabuddhe
Copy link

same problem.

@IlliaBoloto
Copy link

Same!

@alvarobartt
Copy link
Owner

Hi everyone, so this issue is due to Investing.com's new protection with Cloudflare V2, this has affected investpy and investiny, but I've already contacted them so as to see whether we can get to a collaboration agreement, I'll keep you all posted, sorry for the inconveniences...

@normanvdmeijden
Copy link
Author

@alvarobartt thanks for the update. Really appreciate all the work you have done and what you have made possible thusfar!

@jazz-g
Copy link

jazz-g commented Oct 22, 2022

I've gotten the economic_calendar module working again by using the library cfscraper, and using that to make requests by adding
import cfscraper to the imports and
scraper = cfscrape.create_scraper() above the while True loop, and then replacing req = requests.post(url, headers=headers, data=data) with req = scraper.post(url, headers=headers, data=data)

@brianchu1986
Copy link

brianchu1986 commented Oct 22, 2022

I've gotten the economic_calendar module working again by using the library cfscraper, and using that to make requests by adding import cfscraper to the imports and scraper = cfscrape.create_scraper() above the while True loop, and then replacing req = requests.post(url, headers=headers, data=data) with req = scraper.post(url, headers=headers, data=data)

@jazz-g
it works with cfscrape.
thanks for info.

@normanvdmeijden
Copy link
Author

@jazz-g Thanks, but when I tried this I am requested for a license key.
any idea what I am doing wrong?

@Lontaren
Copy link

Hi! What a great community we have, thanks for the solution. @normanvdmeijden I believe you're importing the wrong module, it's supposed to be crscrape (not crscraper)
Thanks for the solution @jazz-g

@normanvdmeijden
Copy link
Author

@jazz-g @Lontaren Yes it is up and running now, thanks for all the support

@varshasahasrabuddhe
Copy link

i need a little bit of help here.
i am using below function. how do i get it using cfscrape
exogs = investpy.economic_calendar(time_zone = "GMT", countries = ["United States"], importances = ['high','medium','low'],from_date= date_from, to_date = date_to)

@Lontaren
Copy link

@varshasahasrabuddhe You need to modify the investpy package (in this case the news.py file) with the code @jazz-g suggested

@varshasahasrabuddhe
Copy link

Thank you Lontaren and @jazz-g

@srinivasakumar-a
Copy link

@varshasahasrabuddhe You need to modify the investpy package (in this case the news.py file) with the code @jazz-g suggested

Thanks a ton! 🥇 this solved my issue :)

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

8 participants