Python Cache Function

Overview

The cache function is a function that utilizes the url function to download data from across the network, but includes additional functionality to save the results to a local hard drive. The saved file acts as a cache, so that further requests for the same data will go to the file instead of re-downloading from the web.

Requests for data utilize the authentication mechanism present in the url function to provide secure access to data.

Data that is cached using the cache function can be set to expire, so that after a specified amount of time, a stale file is deleted and re-donwloaded from the source.

Example Scripts

from davinci.python import cache data = cache('https://server.com/data.json')

VSCode