1
2
3
4
5
6
7
8
9
10 import gconf
11
12
14
16 try:
17 self.gconf_client = gconf.client_get_default()
18 self.gconf_client.notify_add("/system/http_proxy/use_http_proxy", self.get_is_active)
19 self.gconf_client.notify_add("/system/http_proxy/port", self.get_port)
20 self.gconf_client.notify_add("/system/http_proxy/host", self.get_host)
21 except:pass
22 self.get_is_active()
23 self.get_port()
24 self.get_host()
25
27 """Returns if the proxy gnome settings are enabled, shoulnt be used separatly"""
28 try:
29 a = bool(self.gconf_client.get_bool("/system/http_proxy/use_http_proxy"))
30 return a
31 except:
32 return None
34 """Returns the proxy gnome settings port, shoulnt be used separatly"""
35 try:
36 a = self.gconf_client.get_int("/system/http_proxy/port")
37 return a
38 except:
39 return None
41 """Returns the proxy gnome settings host, shoulnt be used separatly"""
42 try:
43 a = self.gconf_client.get_string("/system/http_proxy/host")
44 return a
45 except:
46 return None
47
49 """Return {'http' : HOST:PORT } if available or {} if not"""
50 try:
51 proxy = {}
52 if self.get_is_active():
53 a = self.get_host()
54 b = self.get_port()
55 if a != None and b != None:
56 c = str(a) + ':' + str(b)
57 if c.find ('http://') == -1: c = 'http://' + c
58 proxy['http'] = c
59 return proxy
60
61 else: return proxy
62 except:
63 return {}
64