On Jun 7, 2005, at 5:54, Antoine Pitrou wrote:
> Hi,
>
> I'm porting an app to Mac OS X and I need to retrieve the  
> configuration
> values entered in the System Preferences (specifically the HTTP proxy
> settings). I already know how to do that under Gnome and Windows,  
> but I
> haven't found how to retrieve those values under Mac OS X (Panther, by
> the way). Is there a reliable way to do that ?

$ scutil
 > help

[snip]

 > list
[snip]
   subKey [48] = State:/Network/Global/Proxies
[etc.]

 > show State:/Network/Global/Proxies
<dictionary> {
   RTSPEnable : 0
   ExcludeSimpleHostnames : 0
   ProxyAutoDiscoveryEnable : 0
   FTPPassive : 1
   GopherEnable : 0
   SOCKSEnable : 0
   HTTPPort : 8080
   AppleProxyConfigurationSelected : 2
   HTTPProxy : localhost
   HTTPEnable : 1
}

State:/Network/Global seems to correspond to the current network  
state (as opposed to saved configs which are under Setup:/Network/ 
Service).

 >>> p = os.popen('echo "show State:/Network/Global/Proxies" | scutil')
 >>> p.read()
'<dictionary> {\n  RTSPEnable : 0\n  ExcludeSimpleHostnames : 0\n   
ProxyAutoDiscoveryEnable : 0\n  FTPPassive : 1\n  GopherEnable : 0\n   
SOCKSEnable : 0\n  HTTPPort : 8080\n   
AppleProxyConfigurationSelected : 2\n  HTTPProxy : localhost\n   
HTTPEnable : 0\n}\n'
 >>> p.close()

hth
Doug

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to