Skip to content

Commit fde24f2

Browse files
committed
Adjust readme
1 parent 970717f commit fde24f2

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,13 @@ Process incoming JSON-RPC requests in Python.
1313

1414
To serve JSON-RPC methods:
1515
```python
16-
from jsonrpcserver import Success, method, serve, dispatch
16+
from jsonrpcserver import dispatch, method, Success
1717

1818
@method
1919
def ping():
2020
return Success("pong")
2121

22-
if __name__ == "__main__":
23-
serve()
24-
```
25-
26-
To get a JSON-RPC response:
27-
```python
28-
dispatch('{"jsonrpc": "2.0", "method": "ping", "id": 1}')
22+
response = dispatch('{"jsonrpc": "2.0", "method": "ping", "id": 1}')
2923
# '{"jsonrpc": "2.0", "result": "pong", "id": 1}'
3024
```
3125

0 commit comments

Comments
 (0)