fred icon indicating copy to clipboard operation
fred copied to clipboard

Cache queries / pass session parameter to Fred

Open femtotrader opened this issue 10 years ago • 0 comments

Hello,

you might pass a session parameter to Fred object (with default session=None) and initialize session using

def _init_session(self, session):
    if session is None:
        session = requests.Session()
    return session

so it will be possible to cache queries to database using requests-cache http://requests-cache.readthedocs.org/ (optional dependency)

See https://github.com/pydata/pandas-datareader/blob/master/pandas_datareader/base.py https://github.com/pydata/pandas-datareader/blob/master/pandas_datareader/fred.py http://pandas-datareader.readthedocs.org/en/latest/cache.html

Kind regards

PS: maybe we might merge our code ?

femtotrader avatar Dec 17 '15 05:12 femtotrader