docs/enterprise/extension_query.py
def ComputeExtensionsList(extensions_list, data):
  """Computes list of machines that have an extension.

  This sample function processes the |data| retrieved from the Takeout API and
  calculates the list of machines that have installed each extension listed in
  the data.

  Args:
    extensions_list: the extension list dictionary to fill.
    data: the data fetched from the Takeout API.
  """
  for device in data['browsers']:
    if 'browsers' not in device:
      continue
    for browser in device['browsers']:
      if 'profiles' not in browser:
        continue
      for profile in browser['profiles']:
        if 'extensions' not in profile:
          continue
        for extension in profile['extensions']:
          key = extension['extensionId']
          if 'version' in extension:
            key = key + ' @ ' + extension['version']
          if key not in extensions_list:
            current_extension = {
                'name': extension.get('name', ''),
                'permissions': extension.get('permissions', ''),
                'installed': set(),
                'disabled': set(),
                'forced': set()
            }
          else:
            current_extension = extensions_list[key]

          machine_name = device['machineName']
          current_extension['installed'].add(machine_name)
          if extension.get('installType', '') == 'ADMIN':
            current_extension['forced'].add(machine_name)
          if extension.get('disabled', False):
            current_extension['disabled'].add(machine_name)

          extensions_list[key] = current_extension
Computes list of machines that have an extension.

  This sample function processes the |data| retrieved from the Takeout API and
  calculates the list of machines that have installed each extension listed in
  the data.

  Args:
    extensions_list: the extension list dictionary to fill.
    data: the data fetched from the Takeout API.
  
Computes list of machines that have an extension.
This sample function processes the |data| retrieved from the Takeout API and
calculates the list of machines that have installed each extension listed in
the data.
Computes list of machines that have an extension . This sample function processes the |data| retrieved from the Takeout API and calculates the list of machines that have installed each extension listed in the data .
def ComputeExtensionsList(extensions_list, data):
  for device in data['browsers']:
    if 'browsers' not in device:
      continue
    for browser in device['browsers']:
      if 'profiles' not in browser:
        continue
      for profile in browser['profiles']:
        if 'extensions' not in profile:
          continue
        for extension in profile['extensions']:
          key = extension['extensionId']
          if 'version' in extension:
            key = key + ' @ ' + extension['version']
          if key not in extensions_list:
            current_extension = {
                'name': extension.get('name', ''),
                'permissions': extension.get('permissions', ''),
                'installed': set(),
                'disabled': set(),
                'forced': set()
            }
          else:
            current_extension = extensions_list[key]
          machine_name = device['machineName']
          current_extension['installed'].add(machine_name)
          if extension.get('installType', '') == 'ADMIN':
            current_extension['forced'].add(machine_name)
          if extension.get('disabled', False):
            current_extension['disabled'].add(machine_name)
          extensions_list[key] = current_extension
def ComputeExtensionsList ( extensions_list , data ) : for device in data [ 'browsers' ] : if 'browsers' not in device : continue for browser in device [ 'browsers' ] : if 'profiles' not in browser : continue for profile in browser [ 'profiles' ] : if 'extensions' not in profile : continue for extension in profile [ 'extensions' ] : key = extension [ 'extensionId' ] if 'version' in extension : key = key + ' @ ' + extension [ 'version' ] if key not in extensions_list : current_extension = { 'name' : extension . get ( 'name' , '' ) , 'permissions' : extension . get ( 'permissions' , '' ) , 'installed' : set ( ) , 'disabled' : set ( ) , 'forced' : set ( ) } else : current_extension = extensions_list [ key ] machine_name = device [ 'machineName' ] current_extension [ 'installed' ] . add ( machine_name ) if extension . get ( 'installType' , '' ) == 'ADMIN' : current_extension [ 'forced' ] . add ( machine_name ) if extension . get ( 'disabled' , False ) : current_extension [ 'disabled' ] . add ( machine_name ) extensions_list [ key ] = current_extension
Computes list of machines that have an extension.
Computes list of machines that have an extension .
"""Computes list of machines that have an extension.

  This sample function processes the |data| retrieved from the Takeout API and
  calculates the list of machines that have installed each extension listed in
  the data.

  Args:
    extensions_list: the extension list dictionary to fill.
    data: the data fetched from the Takeout API.
  """
extensions_list
the extension list dictionary to fill.
the extension list dictionary to fill .
data
the data fetched from the Takeout API.
the data fetched from the Takeout API .