pydata / pandas-datareader

Extract data from a wide range of Internet sources into a pandas DataFrame.

Home Page:https://pydata.github.io/pandas-datareader/stable/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pandas_datareader._utils.RemoteDataError

mrhouzlane opened this issue · comments

commented

Code :

import pandas as pd
import pandas_datareader.data as web


FB = web.YahooOptions('FB')

for exp in FB.expiry_dates:
    print(exp.isoformat())

I installed pandas-datareader.

Error :

pandas_datareader._utils.RemoteDataError: Unable to read URL: https://query1.finance.yahoo.com/v7/finance/options/FB

Hello,

I had the same problem. Apparently, the API is refusing requests without headers.

My workaround was to add the headers directly to the object.

Also, the ticket FB is returning blank because it got change to 'META'

FB = web.YahooOptions('META')
FB.headers = {'User-Agent': 'Firefox'}
for exp in FB.expiry_dates:
    print(exp.isoformat())

It would be nice to have a default header for that request IMO.

Hope it helps :)