1
0
Fork 0
mirror of https://github.com/romanz/electrs.git synced 2025-02-22 22:36:37 +01:00

json.loads added

As suggested, `json.loads` was added to parse the raw response.
This commit is contained in:
moneroexamples 2021-06-28 17:44:59 +08:00 committed by GitHub
parent 2d4369cf93
commit a31723cbb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -452,13 +452,14 @@ $ echo '{"jsonrpc": "2.0", "method": "server.version", "params": ["", "1.4"], "i
Corresponding example in `Python`:
```
import json
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')
print(f.readline())
print(json.loads(f.readline()))
```
For more complex tasks, you may need to convert addresses to