mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 01:43:29 +01:00
Added json.dumps to Python example RPC examples
As suggested in https://github.com/romanz/electrs/pull/415#issuecomment-870345086 `json.dumps` is added in-place of a manual construction of a request message.
This commit is contained in:
parent
955910cca3
commit
6caf8017af
@ -458,7 +458,8 @@ import socket
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
s.connect(("127.0.0.1", 50001))
|
||||
f = s.makefile()
|
||||
s.sendall(b'{"jsonrpc": "2.0", "method": "server.version", "params": ["", "1.4"], "id": 0}\n')
|
||||
message = json.dumps({"jsonrpc": "2.0", "method": "server.version", "params": ["", "1.4"], "id": "0"})
|
||||
s.sendall((message + '\n').encode())
|
||||
print(json.loads(f.readline()))
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user