Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import socket
- import json
- import time
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect(('127.0.0.1', 4028))
- sock.send(bytes(json.dumps({'command': 'summary'}), 'UTF-8'))
- resp = ''
- no_resp = 0
- while 1:
- buf = sock.recv(4096)
- if buf:
- resp += buf
- no_resp = 0
- elif resp and not buf:
- no_resp += 1
- if no_resp >= 10:
- break
- result = json.loads(resp[:-1])
- print(result)
- sock.shutdown(socket.SHUT_RDWR)
- sock.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement