Python requests module modification that allows for storing and pulling data from local store, rather than posting requests to servers every time - primarily for testing/bandwidth management
Module is a work in progress, current usage demo:
import localRequests as lr
lr.get(url,params=paramsAsDict, timeout=5)urlis the classic post urlparamsare the standard parameters to post to a url, and used as the key in the storage dict.- timeout, in seconds, will take a timestamp record at the previous post requests, and if necessary, perform a wait function to ensure the specificed time has elapsed.
sourceoptions:None,local,remoteNone(default): will look up local files unless it does not exist, where a post request will be made and savedlocal: will force only use of local files, and return None type for a parameter option not used beforeremote: will force a pull and update of all local files, overwriting each one
verboseprint out of posting requests and waiting time, every time it is requiredpaththe directory path that all pickle files will be stored and read from
Requires the following python modules
requests
pickle
os
timePlease get in touch for any questions