| 1 | import logging |
|---|
| 2 | logging.basicConfig(level=logging.DEBUG, |
|---|
| 3 | format='%(asctime)s %(levelname)-5.5s [%(name)s] %(message)s') |
|---|
| 4 | |
|---|
| 5 | def echo(data): |
|---|
| 6 | """ |
|---|
| 7 | Just return data back to the client. |
|---|
| 8 | """ |
|---|
| 9 | return data |
|---|
| 10 | |
|---|
| 11 | services = { |
|---|
| 12 | 'echo': echo, |
|---|
| 13 | 'echo.echo': echo |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | if __name__ == '__main__': |
|---|
| 17 | from pyamf.remoting.gateway.wsgi import WSGIGateway |
|---|
| 18 | from wsgiref import simple_server |
|---|
| 19 | |
|---|
| 20 | gw = WSGIGateway(services) |
|---|
| 21 | |
|---|
| 22 | httpd = simple_server.WSGIServer( |
|---|
| 23 | ('localhost', 8000), |
|---|
| 24 | simple_server.WSGIRequestHandler, |
|---|
| 25 | ) |
|---|
| 26 | |
|---|
| 27 | httpd.set_app(gw) |
|---|
| 28 | |
|---|
| 29 | print "Running AMF gateway on http://localhost:8000" |
|---|
| 30 | |
|---|
| 31 | try: |
|---|
| 32 | httpd.serve_forever() |
|---|
| 33 | except KeyboardInterrupt: |
|---|
| 34 | pass |
|---|