From 5371558116ad7ff038704f1038ac08383910bb87 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 4 May 2021 03:23:46 +0100 Subject: [PATCH] move example to different port --- README | 5 ++++- jsonapp.py | 2 +- testjsonrpc.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) 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") -- 2.30.2