Package httxlib :: Module httxauthcache :: Class HttxAuthCache
[hide private]
[frames] | no frames]

Class HttxAuthCache

source code

           object --+    
                    |    
httxobject.HttxObject --+
                        |
                       HttxAuthCache

An object that caches data from and for authentication requests

Instance Methods [hide private]
 
__init__(self)
Constructor.
source code
HttxAuthCache
__deepcopy__(self, memo)
Deepcopy support.
source code
int
getnoncecount(self, nonce)
Get a new nonce_count value for nonce
source code
 
set(self, url, headername, scheme, answer, cachedata)
Set a new entry in the cache
source code
tuple
get(self, url, opaque=False)
Get a cache entry for a url
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
dict cache
holds the cache entries
defaultdict(int) noncecache
holds specifically sequestial nonce values for digest authentication

Inherited from httxobject.HttxObject: lock

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Constructor. It delegates construction to the base class HttxObject and initializes the member variables

Overrides: object.__init__

__deepcopy__(self, memo)

source code 

Deepcopy support.

Parameters:
  • memo (dict) - standard __deepcopy__ parameter to avoid circular references
Returns: HttxAuthCache
a cloned object

getnoncecount(self, nonce)

source code 

Get a new nonce_count value for nonce

This will increment the cached value and return and cache the incremented value

Parameters:
  • nonce (str) - nonce value in digest auth requests
Returns: int
a sequentally incremented nonce_count

set(self, url, headername, scheme, answer, cachedata)

source code 

Set a new entry in the cache

Parameters:
  • headername (str) - WWW-Authenticate or Proxy-Authenticate as sent
  • scheme (str) - Basic, Digest or other types of auth
  • answer (str) - Answer sent to the server
  • cachedata (str) - Specific data cached to be used if a new auth request is seen

get(self, url, opaque=False)

source code 

Get a cache entry for a url

The search is done hierarchically, because once authorized in an url all sub-urls (same domain and same initial) path will likely send the same authorization request

Parameters:
  • url (str) - url for the http request
  • opaque (bool (Default: False)) - if no assumption has to be made about the stored data and just cachedata has to be returned
Returns: tuple
A tuple with the headername to be sent and the header content Both values can be None to indicate that no entry was found