parameters: (self)
docstring: Authenticates the user.
  
      The authentication process works as follows:
       1) We get a username and password from the user
       2) We use ClientLogin to obtain an AUTH token for the user
          (see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
       3) We pass the auth token to /_ah/login on the server to obtain an
          authentication cookie. If login was successful, it tries to redirect
          us to the URL we provided.
  
      If we attempt to access the upload API without first obtaining an
      authentication cookie, it returns a 401 response (or a 302) and
      directs us to authenticate ourselves with ClientLogin.
docstring_summary: Authenticates the user.
docstring_tokens: Authenticates the user .
function: def _Authenticate(self):
      """Authenticates the user.
  
      The authentication process works as follows:
       1) We get a username and password from the user
       2) We use ClientLogin to obtain an AUTH token for the user
          (see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
       3) We pass the auth token to /_ah/login on the server to obtain an
          authentication cookie. If login was successful, it tries to redirect
          us to the URL we provided.
  
      If we attempt to access the upload API without first obtaining an
      authentication cookie, it returns a 401 response (or a 302) and
      directs us to authenticate ourselves with ClientLogin.
      """
      for i in range(3):
        credentials = self.auth_function()
        try:
          auth_token = self._GetAuthToken(credentials[0], credentials[1])
        except ClientLoginError, e:
          print >>sys.stderr, ''
          if e.reason == "BadAuthentication":
            if e.info == "InvalidSecondFactor":
              print >>sys.stderr, (
                  "Use an application-specific password instead "
                  "of your regular account password.\n"
                  "See http://www.google.com/"
                  "support/accounts/bin/answer.py?answer=185833")
            else:
              print >>sys.stderr, "Invalid username or password."
          elif e.reason == "CaptchaRequired":
            print >>sys.stderr, (
                "Please go to\n"
                "https://www.google.com/accounts/DisplayUnlockCaptcha\n"
                "and verify you are a human.  Then try again.\n"
                "If you are using a Google Apps account the URL is:\n"
                "https://www.google.com/a/yourdomain.com/UnlockCaptcha")
          elif e.reason == "NotVerified":
            print >>sys.stderr, "Account not verified."
          elif e.reason == "TermsNotAgreed":
            print >>sys.stderr, "User has not agreed to TOS."
          elif e.reason == "AccountDeleted":
            print >>sys.stderr, "The user account has been deleted."
          elif e.reason == "AccountDisabled":
            print >>sys.stderr, "The user account has been disabled."
            break
          elif e.reason == "ServiceDisabled":
            print >>sys.stderr, ("The user's access to the service has been "
                                 "disabled.")
          elif e.reason == "ServiceUnavailable":
            print >>sys.stderr, "The service is not available; try again later."
          else:
            # Unknown error.
            raise
          print >>sys.stderr, ''
          continue
        self._GetAuthCookie(auth_token)
        return
function_tokens: def _Authenticate ( self ) : for i in range ( 3 ) : credentials = self . auth_function ( ) try : auth_token = self . _GetAuthToken ( credentials [ 0 ] , credentials [ 1 ] ) except ClientLoginError , e : print >> sys . stderr , '' if e . reason == "BadAuthentication" : if e . info == "InvalidSecondFactor" : print >> sys . stderr , ( "Use an application-specific password instead " "of your regular account password.\n" "See http://www.google.com/" "support/accounts/bin/answer.py?answer=185833" ) else : print >> sys . stderr , "Invalid username or password." elif e . reason == "CaptchaRequired" : print >> sys . stderr , ( "Please go to\n" "https://www.google.com/accounts/DisplayUnlockCaptcha\n" "and verify you are a human.  Then try again.\n" "If you are using a Google Apps account the URL is:\n" "https://www.google.com/a/yourdomain.com/UnlockCaptcha" ) elif e . reason == "NotVerified" : print >> sys . stderr , "Account not verified." elif e . reason == "TermsNotAgreed" : print >> sys . stderr , "User has not agreed to TOS." elif e . reason == "AccountDeleted" : print >> sys . stderr , "The user account has been deleted." elif e . reason == "AccountDisabled" : print >> sys . stderr , "The user account has been disabled." break elif e . reason == "ServiceDisabled" : print >> sys . stderr , ( "The user's access to the service has been " "disabled." ) elif e . reason == "ServiceUnavailable" : print >> sys . stderr , "The service is not available; try again later." else : # Unknown error. raise print >> sys . stderr , '' continue self . _GetAuthCookie ( auth_token ) return