def set_caching(self, cache_db='mygene_cache', verbose=True, **kwargs):
''' Installs a local cache for all requests.
**cache_db** is the path to the local sqlite cache database.'''
if caching_avail:
requests_cache.install_cache(cache_name=cache_db, allowable_methods=('GET', 'POST'), **kwargs)
self._cached = True
if verbose:
print('[ Future queries will be cached in "{0}" ]'.format(os.path.abspath(cache_db + '.sqlite')))
else:
print("Error: The requests_cache python module is required to use request caching.")
print("See - https://requests-cache.readthedocs.io/en/latest/user_guide.html#installation")
return
评论列表
文章目录