mcdallas / wallstreet

Real time stock and option data.
MIT License
1.24k stars 197 forks source link

Error raised by query2.finance.yahoo.com #32

Closed seranki closed 2 years ago

seranki commented 2 years ago

This example was working a couple of days ago. Today it is raising an error.

from wallstreet import Stock, Call, Put
s = Stock('AAPL')
Traceback (most recent call last):
File "", line 1, in
File "/Volumes/Backup/Users/......./anaconda3/lib/python3.7/site-packages/wallstreet/wallstreet.py", line 112, in init
self._yahoo(quote, exchange)
File "/Volumes/Backup/Users/......./anaconda3/lib/python3.7/site-packages/wallstreet/wallstreet.py", line 126, in _yahoo
r.raise_for_status()
File "/Volumes/Backup/Users/......./anaconda3/lib/python3.7/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://query2.finance.yahoo.com/v7/finance/options/AAPL

mcdallas commented 2 years ago

Looks like they now block non-browser user agents. #31 should fix this. Try reinstalling the newer version

seranki commented 2 years ago

Thanks for the rapid fix. 'pip uninstall' followed by 'pip install' updated wallstreet to v 0.3.1 The python script that uses wallstreet is now working again