From: Luke Kenneth Casson Leighton Date: Tue, 4 May 2021 02:23:46 +0000 (+0100) Subject: move example to different port X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;p=multitaskhttpd.git move example to different port --- diff --git a/README b/README index 2e37e13..be6e13c 100644 --- a/README +++ b/README @@ -7,7 +7,10 @@ So far, this includes a basic HTTP server based on SimpleHTTPServer: and a JSONRPC test application: python jsonapp.py -The latter is where it gets interesting. Session cookies are automatically +then run the jsonrpclib test: + python testjsonrpc.py + +The jsonapp.py is where it gets interesting. Session cookies are automatically used to create application instances which are persistent in memory (TODO: drop them after an application-specified timeout of course...) diff --git a/jsonapp.py b/jsonapp.py index 12781ba..9ae9d0f 100644 --- a/jsonapp.py +++ b/jsonapp.py @@ -17,6 +17,6 @@ class MyApp(SimpleJSONRPCRequestHandler, BaseApp): httpd.set_debug(True) agent = HTTPServer() agent.apps = dict({'/json': MyApp, '*': App}) -agent.start() +agent.start(port=8089) multitask.run() diff --git a/testjsonrpc.py b/testjsonrpc.py index 47eae40..e70f0d5 100644 --- a/testjsonrpc.py +++ b/testjsonrpc.py @@ -3,7 +3,7 @@ import jsonrpclib class TestJsolait(unittest.TestCase): def test_echo(self): - s = jsonrpclib.ServerProxy("http://127.0.0.1:8080/json", verbose=0) + s = jsonrpclib.Server("http://127.0.0.1:8089/json", verbose=0) reply = s.echo("hello") print reply #self.assert_(reply["result"] == "foo bar")