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