def getPacFiles():
 pacFiles = []
 if (sys.platform == 'win32'):
  try:
   import _winreg as winreg
  except ImportError:
   import winreg
  net = winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings')
  (nSubs, nVals, lastMod) = winreg.QueryInfoKey(net)
  subkeys = {}
  for i in range(nVals):
   (thisName, thisVal, thisType) = winreg.EnumValue(net, i)
   subkeys[thisName] = thisVal
  if (('AutoConfigURL' in subkeys.keys()) and (len(subkeys['AutoConfigURL']) > 0)):
   pacFiles.append(subkeys['AutoConfigURL'])
 elif (sys.platform == 'darwin'):
  import plistlib
  sysPrefs = plistlib.readPlist('/Library/Preferences/SystemConfiguration/preferences.plist')
  networks = sysPrefs['NetworkServices']
  for network in networks.items():
   (netKey, network) = network
   if ('ProxyAutoConfigURLString' in network['Proxies'].keys()):
    pacFiles.append(network['Proxies']['ProxyAutoConfigURLString'])
 return list(set(pacFiles))

def getPacFiles ( ) : pacFiles = [ ] if ( sys . platform == 'win32' ) : try : import _winreg as winreg except ImportError : import winreg net = winreg . OpenKey ( winreg . HKEY_CURRENT_USER , 'Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings' ) ( nSubs , nVals , lastMod ) = winreg . QueryInfoKey ( net ) subkeys = { } for i in range ( nVals ) : ( thisName , thisVal , thisType ) = winreg . EnumValue ( net , i ) subkeys [ thisName ] = thisVal if ( ( 'AutoConfigURL' in subkeys . keys ( ) ) and ( len ( subkeys [ 'AutoConfigURL' ] ) > 0 ) ) : pacFiles . append ( subkeys [ 'AutoConfigURL' ] ) elif ( sys . platform == 'darwin' ) : import plistlib sysPrefs = plistlib . readPlist ( '/Library/Preferences/SystemConfiguration/preferences.plist' ) networks = sysPrefs [ 'NetworkServices' ] for network in networks . items ( ) : ( netKey , network ) = network if ( 'ProxyAutoConfigURLString' in network [ 'Proxies' ] . keys ( ) ) : pacFiles . append ( network [ 'Proxies' ] [ 'ProxyAutoConfigURLString' ] ) return list ( set ( pacFiles ) )
return a list of possible auto proxy .