parameters: (filename)
return_statement: return get_ha1
docstring: Returns a get_ha1 function which obtains a HA1 password hash from a
      flat file with lines of the same format as that produced by the Apache
      htdigest utility. For example, for realm 'wonderland', username 'alice',
      and password '4x5istwelve', the htdigest line would be::
  
          alice:wonderland:3238cdfe91a8b2ed8e39646921a02d4c
  
      If you want to use an Apache htdigest file as the credentials store,
      then use get_ha1_file_htdigest(my_htdigest_file) as the value for the
      get_ha1 argument to digest_auth().  It is recommended that the filename
      argument be an absolute path, to avoid problems.
docstring_summary: Returns a get_ha1 function which obtains a HA1 password hash from a
      flat file with lines of the same format as that produced by the Apache
      htdigest utility. For example, for realm 'wonderland', username 'alice',
      and password '4x5istwelve', the htdigest line would be::
docstring_tokens: Returns a get_ha1 function which obtains a HA1 password hash from a flat file with lines of the same format as that produced by the Apache htdigest utility . For example for realm wonderland username alice and password 4x5istwelve the htdigest line would be ::
function: def get_ha1_file_htdigest(filename):
      """Returns a get_ha1 function which obtains a HA1 password hash from a
      flat file with lines of the same format as that produced by the Apache
      htdigest utility. For example, for realm 'wonderland', username 'alice',
      and password '4x5istwelve', the htdigest line would be::
  
          alice:wonderland:3238cdfe91a8b2ed8e39646921a02d4c
  
      If you want to use an Apache htdigest file as the credentials store,
      then use get_ha1_file_htdigest(my_htdigest_file) as the value for the
      get_ha1 argument to digest_auth().  It is recommended that the filename
      argument be an absolute path, to avoid problems.
      """
      def get_ha1(realm, username):
          result = None
          f = open(filename, 'r')
          for line in f:
              u, r, ha1 = line.rstrip().split(':')
              if u == username and r == realm:
                  result = ha1
                  break
          f.close()
          return result
  
      return get_ha1
function_tokens: def get_ha1_file_htdigest ( filename ) : def get_ha1 ( realm , username ) : result = None f = open ( filename , 'r' ) for line in f : u , r , ha1 = line . rstrip ( ) . split ( ':' ) if u == username and r == realm : result = ha1 break f . close ( ) return result return get_ha1