File: cmd.py

package info (click to toggle)
python-jsonrpc2 0.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 184 kB
  • sloc: python: 275; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 459 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
import sys
from jsonrpc2 import JsonRpcApplication
from wsgiref.simple_server import make_server

def main(host='', port=8080):
    """
    """
    app = JsonRpcApplication()

    for m in sys.argv[1:]:
        __import__(m)
        mod = sys.modules[m]
        app.rpc.add_module(mod)
    print 'runserver %s:%d' % (host, port)
    httpd = make_server(host, port, app)
    httpd.serve_forever()

if __name__ == '__main__':
    main()