tools/traffic_annotation/scripts/update_annotations_doc.py
def _get_credentials(self, credentials_file_path, client_token_file_path):
    """ Gets valid user credentials from storage. If nothing has been stored, or
    if the stored credentials are invalid, the OAuth2 flow is completed to
    obtain the new credentials.

    When running in the buildbot, uses LUCI credentials instead.

    Args:
      credentials_file_path: str
        Absolute path to read credentials.json.
      client_token_file_path: str
        Absolute path to read/save user secret token.

    Returns:
      OAuth2Credentials The obtained user credentials.
    """
    if luci_auth.available():
      return luci_auth.LUCICredentials(scopes=[self.SCOPES])

    store = Storage(os.path.join(SRC_DIR, client_token_file_path))
    credentials = store.get()

    if not credentials or credentials.invalid:
      flow = client.flow_from_clientsecrets(
          os.path.join(SRC_DIR, credentials_file_path), self.SCOPES)
      flow.user_agent = self.APPLICATION_NAME
      flags = tools.argparser.parse_args([])
      credentials = tools.run_flow(flow, store, flags)
      print("Storing credentials to " + credentials_file_path)
    return credentials
 Gets valid user credentials from storage. If nothing has been stored, or
    if the stored credentials are invalid, the OAuth2 flow is completed to
    obtain the new credentials.

    When running in the buildbot, uses LUCI credentials instead.

    Args:
      credentials_file_path: str
        Absolute path to read credentials.json.
      client_token_file_path: str
        Absolute path to read/save user secret token.

    Returns:
      OAuth2Credentials The obtained user credentials.
    
Gets valid user credentials from storage. If nothing has been stored, or
if the stored credentials are invalid, the OAuth2 flow is completed to
obtain the new credentials.

When running in the buildbot, uses LUCI credentials instead.
Gets valid user credentials from storage . If nothing has been stored or if the stored credentials are invalid the OAuth2 flow is completed to obtain the new credentials . When running in the buildbot uses LUCI credentials instead .
def _get_credentials(self, credentials_file_path, client_token_file_path):
    if luci_auth.available():
      return luci_auth.LUCICredentials(scopes=[self.SCOPES])
    store = Storage(os.path.join(SRC_DIR, client_token_file_path))
    credentials = store.get()
    if not credentials or credentials.invalid:
      flow = client.flow_from_clientsecrets(
          os.path.join(SRC_DIR, credentials_file_path), self.SCOPES)
      flow.user_agent = self.APPLICATION_NAME
      flags = tools.argparser.parse_args([])
      credentials = tools.run_flow(flow, store, flags)
      print("Storing credentials to " + credentials_file_path)
    return credentials
def _get_credentials ( self , credentials_file_path , client_token_file_path ) : if luci_auth . available ( ) : return luci_auth . LUCICredentials ( scopes = [ self . SCOPES ] ) store = Storage ( os . path . join ( SRC_DIR , client_token_file_path ) ) credentials = store . get ( ) if not credentials or credentials . invalid : flow = client . flow_from_clientsecrets ( os . path . join ( SRC_DIR , credentials_file_path ) , self . SCOPES ) flow . user_agent = self . APPLICATION_NAME flags = tools . argparser . parse_args ( [ ] ) credentials = tools . run_flow ( flow , store , flags ) print ( "Storing credentials to " + credentials_file_path ) return credentials
Gets valid user credentials from storage.
Gets valid user credentials from storage .
""" Gets valid user credentials from storage. If nothing has been stored, or
    if the stored credentials are invalid, the OAuth2 flow is completed to
    obtain the new credentials.

    When running in the buildbot, uses LUCI credentials instead.

    Args:
      credentials_file_path: str
        Absolute path to read credentials.json.
      client_token_file_path: str
        Absolute path to read/save user secret token.

    Returns:
      OAuth2Credentials The obtained user credentials.
    """
OAuth2Credentials The obtained user credentials.
OAuth2Credentials The obtained user credentials .
self
credentials_file_path
str
Absolute path to read credentials.json.
str Absolute path to read credentials . json .
client_token_file_path
str
Absolute path to read/save user secret token.
str Absolute path to read / save user secret token .