Package soovee_lib :: Module cache :: Class Cache
[frames] | no frames]

Class Cache

Store Internet files locally.

Progress Update Hook

Instance Methods
None
__init__(self, urlpath, **options)
Intialize cache file for urlpath.
[basestring|bin]
data(self, mode='r')
Provide access to an intialized object's data.
Method Details

__init__(self, urlpath, **options)
(Constructor)

 

Intialize cache file for urlpath. Cache file name will be passed as keyword or created by a md5 hash of urlpath. Working directory can be passed as a keyword too to write file to a different location. All keywords are passed on to self._cacheData which manages the transaction.

Parameters:
  • urlpath (basestring) - Internet path-filename to retrieve original
  • filepath - Local filepath fragment. (basestring)
  • workpath - Local workpath fragment. (basestring)
  • post - Url-encoded dictionary of values. (basestring)
  • hook - Object that will recieve progress updates. (object)
  • update - Switch to update cache when a local file exists. (bool)
Returns: None

Requires: soovee_lib.mkuri

data(self, mode='r')

 

Provide access to an intialized object's data. Data will come either from its cache file or the data saved in self._urlContent.

Parameters:
  • mode (basestring) - Option of file open. [r|rb]. Default 'r'.
Returns: [basestring|bin]
content of object's cached file

Requires: cStringIO