11 def __init__(self, structure):
13 self.structure = structure
18 self.return_fields = []
34 self.data = self.make_data()
38 args = self.structure.split(";");
40 self.channel = args[1]
41 self.print_method = args[2]
42 self.print_options = ast.literal_eval(args[3])
43 self.authType = args[4]
44 self.server = ast.literal_eval(args[5])
45 self.server = self.server["server"]
46 self.methode = args[6]
47 self.parameters = ast.literal_eval(args[7])
48 self.return_fields = eval(args[8])
51 if self.authType=="anonymous":
52 self.auth["AuthMethod"] = "anonymous"
53 elif type=="password":
54 self.auth["AuthMethod"] = "password"
55 self.auth["Username"] = "XXX"
56 self.auth["AuthString"] = "XXX"
57 elif self.authType=="session":
58 self.auth["AuthMethod"] = "session"
59 self.auth["session"] = "XXX"
60 elif self.authType=="gpg":
61 self.auth["AuthMethod"] = "gpg"
62 self.auth["name"] = "XXX"
63 self.auth["signature"] = "XXX"
65 def include_geoposition(self, data):
69 i["ape_position"] = self.get_geoposition(i)
74 sites_id = self.srv.GetSites(self.auth,{},["site_id","latitude","longitude"])
80 if i["site_id"]==j["site_id"]:
82 pos=[{"latitude": j["latitude"], "longitude": j["longitude"]}]
86 i["ape_position"] = pos
93 def get_geoposition(self,i):
94 if self.geo_methode == "site_id":
97 geo_pos = self.srv.GetSites(self.auth, {"site_id": id}, ["latitude","longitude"])
105 def get_event_list_from_xmlrpc(self):
106 self.srv = xmlrpclib.Server(self.server, allow_none = 1)
107 if self.methode=="GetSites":
108 self.geo_methode="site_id";
110 if len(self.return_fields)==0:
111 return self.srv.GetSites(self.auth, self.parameters)
113 return self.srv.GetSites(self.auth, self.parameters, self.return_fields)
126 rototo = self.get_event_list_from_xmlrpc()
131 return self.include_geoposition(rototo)