def setUrlCache(self,url,v,level = 3): #if self.cache == False: # return vv = {} vv['url'] = v['url'] vv['headers'] = v['headers'] vv['cache'] = True vv['body'] = v['body'] vv['local'] = v['local'] cp = PtCp() path = self.getUrlCacheFile(url,level) makeDir(os.path.dirname(path)) cp.dump(vv, path)
def getCacheContent(self,url): cp = PtCp() path = self.getUrlCacheFile(url) return cp.load(path)