(header)
Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None
Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None
Parse rfc2617 HTTP authentication header string ( basic ) and return ( user pass ) tuple or None
def parse_auth(header):
    """ Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None"""
    try:
        method, data = header.split(None, 1)
        if method.lower() == 'basic':
            user, pwd = touni(base64.b64decode(tob(data))).split(':',1)
            return user, pwd
    except (KeyError, ValueError):
        return None
def parse_auth ( header ) : try : method , data = header . split ( None , 1 ) if method . lower ( ) == 'basic' : user , pwd = touni ( base64 . b64decode ( tob ( data ) ) ) . split ( ':' , 1 ) return user , pwd except ( KeyError , ValueError ) : return None