fred
fred copied to clipboard
Cache queries / pass session parameter to Fred
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 ?