PythonAnywhere Forums

Panda Datareader and Yahoo


I've just upgraded my panda-datareader package to the last version (0.5.0) but I am still getting trouble fetching quotes from Yahoo Finance API. It seems to be randomly failing getting the data.

Sometime, it is working and sometimes I'm getting an error saying it is unable to read URL... When I launch the last line several times, I get around one error out of 5 attempts (the other attempts ending well...)

Do you have any idea ? Thanks in advance for your help.

from pandas_datareader import data
import time

today = time.strftime("%m/%d/%Y")
valeur = data.DataReader('RCO.PA',data_source='yahoo',start='1/1/2015',end=today)

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/mfk/.local/lib/python3.5/site-packages/pandas_datareader/", line 121, in DataReader session=session).read() File "/home/mfk/.local/lib/python3.5/site-packages/pandas_datareader/yahoo/", line 115, in read df = super(YahooDailyReader, self).read() File "/home/mfk/.local/lib/python3.5/site-packages/pandas_datareader/", line 181, in read params=self._get_params(self.symbols)) File "/home/mfk/.local/lib/python3.5/site-packages/pandas_datareader/", line 79, in _read_one_data out = self._read_url_as_StringIO(url, params=params) File "/home/mfk/.local/lib/python3.5/site-packages/pandas_datareader/", line 90, in _read_url_as_StringIO response = self._get_response(url, params=params) File "/home/mfk/.local/lib/python3.5/site-packages/pandas_datareader/", line 139, in _get_response raise RemoteDataError('Unable to read URL: {0}'.format(url)) pandas_datareader._utils.RemoteDataError: Unable to read URL:

an intermittent error is strange... could it be actual problems with yahoo finance?

I've read that there were some issues with Yahoo Finance that has changed the API in May, but the new version of panda-datareader should work according to the documentation, as they have taken this change into account.

the other possibility could be that yahoo are throttling the service somehow? APIs often use the status code 429 to signify "too many requests", can you check whether that's what you're getting?