(interface, networks, sudo_password=None)
Adds |networks| as preferred networks to |interface| from position 0.

  Each network should be specified as the SSID and associated
  encryption type, seperated by a $ sign (which is not legal in SSIDs).
  Allowed encryption types are specified in _SECURITY_TYPES.

  The network list is inserted at position 0, so any existing networks which
  are not specified by |networks| will be moved below. As the passed in network
  list is assumed to be in order, the list is reversed before beginning

  If no interface is passed the method returns immediately.

  Note: Because this could potentially cause _lots_ of password dialogs, a sudo
  password must be supplied or the Python process must be running as root.

  Args:
    interface: the interface ID (e.g. en0).
    networks: the list of networks.
    sudo_password: password to get sudo access. required if not running as root.

  Raises:
    NotRunningAsRootError: not running as root and no sudo_password supplied.
Adds |networks| as preferred networks to |interface| from position 0.
Adds |networks| as preferred networks to |interface| from position 0 .
def ResetPreferredNetworks(interface, networks, sudo_password=None):
  """Adds |networks| as preferred networks to |interface| from position 0.

  Each network should be specified as the SSID and associated
  encryption type, seperated by a $ sign (which is not legal in SSIDs).
  Allowed encryption types are specified in _SECURITY_TYPES.

  The network list is inserted at position 0, so any existing networks which
  are not specified by |networks| will be moved below. As the passed in network
  list is assumed to be in order, the list is reversed before beginning

  If no interface is passed the method returns immediately.

  Note: Because this could potentially cause _lots_ of password dialogs, a sudo
  password must be supplied or the Python process must be running as root.

  Args:
    interface: the interface ID (e.g. en0).
    networks: the list of networks.
    sudo_password: password to get sudo access. required if not running as root.

  Raises:
    NotRunningAsRootError: not running as root and no sudo_password supplied.
  """
  if not interface:
    return

  if os.geteuid() and not sudo_password:
    raise NotRunningAsRootError('ResetPreferredNetworks requires root access')

  for nw in reversed(networks):
    nw_name, nw_security = SplitNetworkNameSecurity(nw)
    RemovePreferredNetwork(interface, nw_name, sudo_password=sudo_password)
    AddPreferredNetwork(interface, nw_name, nw_security, index=0,
                        sudo_password=sudo_password)
def ResetPreferredNetworks ( interface , networks , sudo_password = None ) : if not interface : return if os . geteuid ( ) and not sudo_password : raise NotRunningAsRootError ( 'ResetPreferredNetworks requires root access' ) for nw in reversed ( networks ) : nw_name , nw_security = SplitNetworkNameSecurity ( nw ) RemovePreferredNetwork ( interface , nw_name , sudo_password = sudo_password ) AddPreferredNetwork ( interface , nw_name , nw_security , index = 0 , sudo_password = sudo_password )