Skip to content
  • Guido Trotter's avatar
    RapiClient: fix multi-authentication in Python 2.6 · 14ff387e
    Guido Trotter authored
    
    
    In Python 2.6 the urllib2.HTTPBasicAuthHandler has a "retried" count for
    failed authentications. The handler fails after 5 of them. To solve this
    we reset the handler's "retried" member variable to 0 after every
    successful request. This is a bit ugly, but makes the client work again
    for more than 5 requests under all versions of Python.
    
    Note that the digest authentication handler has a reset_retry_count()
    method to do this, but the method is not defined for the basic
    authentication handler, so we must reset the variable itself.
    
    This member variable is unused in 2.4 and 2.5, so the change doesn't
    affect the client under older Python versions.
    
    Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
    Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
    14ff387e