]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blob - www/rpc.py
Add translation page.
[people/shoehn/ipfire.org.git] / www / rpc.py
1 #!/usr/bin/python
2
3 import cgi
4 import simplejson as json
5
6 from rpc_functions import *
7
8 form = cgi.FieldStorage()
9 method = form.getfirst("method")
10 id = form.getfirst("id")
11
12 params = None
13 param_string = form.getfirst("params")
14 if param_string:
15 params = json.loads(param_string)
16
17 methods = { "cluster_get_info" : cluster_get_info,
18 "uriel_send_info" : uriel_send_info, }
19
20 if method and methods.has_key(method):
21 print json.dumps({ "version": "1.1",
22 "id": id or "null",
23 "result" : methods[method](params),
24 "error" : "null", },
25 sort_keys=True, indent=4)