Ticket #467: server.py

File server.py, 678 bytes (added by thijs, 18 months ago)
Line 
1# Copyright (c) 2007-2009 The PyAMF Project.
2# See LICENSE for details.
3
4"""
5ByteArray test server.
6"""
7
8from pyamf.amf3 import ByteArray
9
10def ba():
11    print 'called ba'
12    return ByteArray()
13
14services = {
15    'ba.test': ba,
16}
17
18if __name__ == '__main__':
19    from pyamf.remoting.gateway.wsgi import WSGIGateway
20    from wsgiref import simple_server
21
22    gw = WSGIGateway(services)
23
24    httpd = simple_server.WSGIServer(
25        ('localhost', 8000),
26        simple_server.WSGIRequestHandler,
27    )
28
29    httpd.set_app(gw)
30
31    print "Running ByteArray Test AMF gateway on http://localhost:8000"
32
33    try:
34        httpd.serve_forever()
35    except KeyboardInterrupt:
36        pass