Package wsgitools :: Module digest
[hide private]
[frames] | no frames]

Module digest

source code

Classes [hide private]
  AuthenticationRequired
Internal Exception class that is thrown inside AuthDigestMiddleware, but not visible to other code.
  AuthTokenGenerator
Generates authentification tokens for AuthDigestMiddleware.
  NonceStoreBase
Nonce storage interface.
  StatelessNonceStore
This is a stateless nonce storage that cannot check the usage count for a nonce and thus cannot protect against replay attacks.
  MemoryNonceStore
Simple in-memory mechanism to store nonces.
  LazyDBAPI2Opener
Connects to database on first request.
  DBAPI2NonceStore
A dbapi2-backed nonce store implementation suitable for usage with forking wsgi servers such as scgi.forkpool.
  AuthDigestMiddleware
Middleware partly implementing RFC2617.
Functions [hide private]
 
gen_rand_str(bytes=33)
Generates a string of random base64 characters.
source code
 
parse_digest_response(data, ret=None)
internal
source code
str
format_time(seconds)
internal method formatting a unix time to a fixed-length string
source code
Variables [hide private]
  sysrand = random.SystemRandom()
Function Details [hide private]

gen_rand_str(bytes=33)

source code 

Generates a string of random base64 characters.

Parameters:
  • bytes - is the number of random 8bit values to be used
    >>> gen_rand_str() != gen_rand_str()
    True

parse_digest_response(data, ret=None)

source code 

internal

Raises:
  • ValueError -
    >>> parse_digest_response('foo=bar')
    {'foo': 'bar'}
    >>> parse_digest_response('foo="bar"')
    {'foo': 'bar'}
    >>> sorted(parse_digest_response('foo="bar=qux",spam=egg').items())
    [('foo', 'bar=qux'), ('spam', 'egg')]
    >>> try:
    ...     parse_digest_response('spam')
    ... except ValueError:
    ...     print("ValueError")
    ValueError
    >>> try:
    ...     parse_digest_response('spam="egg"error')
    ... except ValueError:
    ...     print("ValueError")
    ValueError

format_time(seconds)

source code 

internal method formatting a unix time to a fixed-length string

Parameters:
  • seconds (float)
Returns: str