def OSXFindProxies():
 sc = objc.SystemConfiguration()
 settings = sc.dll.SCDynamicStoreCopyProxies(None)
 if (not settings):
  return []
 try:
  cf_http_enabled = sc.CFDictRetrieve(settings, 'kSCPropNetProxiesHTTPEnable')
  if (cf_http_enabled and bool(sc.CFNumToInt32(cf_http_enabled))):
   cfproxy = sc.CFDictRetrieve(settings, 'kSCPropNetProxiesHTTPProxy')
   cfport = sc.CFDictRetrieve(settings, 'kSCPropNetProxiesHTTPPort')
   if (cfproxy and cfport):
    proxy = sc.CFStringToPystring(cfproxy)
    port = sc.CFNumToInt32(cfport)
    return [('http://%s:%d/' % (proxy, port))]
  cf_auto_enabled = sc.CFDictRetrieve(settings, 'kSCPropNetProxiesProxyAutoConfigEnable')
  if (cf_auto_enabled and bool(sc.CFNumToInt32(cf_auto_enabled))):
   cfurl = sc.CFDictRetrieve(settings, 'kSCPropNetProxiesProxyAutoConfigURLString')
   if cfurl:
    unused_url = sc.CFStringToPystring(cfurl)
    return []
 finally:
  sc.dll.CFRelease(settings)
 return []

def OSXFindProxies ( ) : sc = objc . SystemConfiguration ( ) settings = sc . dll . SCDynamicStoreCopyProxies ( None ) if ( not settings ) : return [ ] try : cf_http_enabled = sc . CFDictRetrieve ( settings , 'kSCPropNetProxiesHTTPEnable' ) if ( cf_http_enabled and bool ( sc . CFNumToInt32 ( cf_http_enabled ) ) ) : cfproxy = sc . CFDictRetrieve ( settings , 'kSCPropNetProxiesHTTPProxy' ) cfport = sc . CFDictRetrieve ( settings , 'kSCPropNetProxiesHTTPPort' ) if ( cfproxy and cfport ) : proxy = sc . CFStringToPystring ( cfproxy ) port = sc . CFNumToInt32 ( cfport ) return [ ( 'http://%s:%d/' % ( proxy , port ) ) ] cf_auto_enabled = sc . CFDictRetrieve ( settings , 'kSCPropNetProxiesProxyAutoConfigEnable' ) if ( cf_auto_enabled and bool ( sc . CFNumToInt32 ( cf_auto_enabled ) ) ) : cfurl = sc . CFDictRetrieve ( settings , 'kSCPropNetProxiesProxyAutoConfigURLString' ) if cfurl : unused_url = sc . CFStringToPystring ( cfurl ) return [ ] finally : sc . dll . CFRelease ( settings ) return [ ]
this reads the osx system configuration and gets the proxies .