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:
parent
2d4369cf93
commit
a31723cbb5
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue