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

read URL yahoo finance #276

Closed
KenziTrader opened this issue Jan 15, 2023 · 2 comments
Closed

read URL yahoo finance #276

KenziTrader opened this issue Jan 15, 2023 · 2 comments

Comments

@KenziTrader
Copy link

I try to read an options chain from yahoo finance with pandas_datareader. Reading the URL fails with b'Forbidden'. I can open the URL in Safari.

Do I need to do something special to give Carnets permission to open an URL?

Thanks,
Rene

image

@holzschu
Copy link
Owner

Carnets and Pandas can open URLs, so I think your problem is specific to Yahoo Finance.

Looking at open issues in pandas_datareader, I see this one, which is very similar: pydata/pandas-datareader#923
There is even a suggested fix:

FB = web.YahooOptions('FB')
FB.headers = {'User-Agent': 'Firefox'}
print(FB.expiry_dates)

@KenziTrader
Copy link
Author

Yes, thanks, setting the user agent works.

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

2 participants