forked from hyphanet/pyFreenet
-
Notifications
You must be signed in to change notification settings - Fork 4
/
fcpxmlrpc.cgi
executable file
·51 lines (33 loc) · 1.04 KB
/
fcpxmlrpc.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python2
# CGI-based XML-RPC interface to FCP
# You can use this on your FCP server
from SimpleXMLRPCServer import CGIXMLRPCRequestHandler
import fcp
from fcp.xmlrpc import FreenetXMLRPCRequestHandler
# hostname and port of FCP interface
fcpHost = "10.0.0.1"
fcpPort = 9481
# verbosity for logging
verbosity = node.DETAIL
# where the logfile is
logfile = "/tmp/fcpxmlrpc.log"
def main():
# create the fcp node interface
node = fcp.FCPNode(host=fcpHost,
port=fcpPort,
verbosity=verbosity,
logfile=logfile,
)
# create the request handler
hdlr = FreenetXMLRPCRequestHandler(node)
# create the handler
handler = CGIXMLRPCRequestHandler()
handler.register_introspection_functions()
# link in the node wrapper
handler.register_instance(hdlr)
# now do the business
handler.handle_request()
node.shutdown()
if __name__ == '__main__':
main()
import fcpxmlrpc