INNER CODE UNIT · Python
send_request
SpartanJ/eepp · projects/scripts/acp_mock_agent.py:10
def send_request(msg_id, method, params):
msg = {"jsonrpc": "2.0", "id": msg_id, "method": method, "params": params}
sys.stdout.write(json.dumps(msg) + "\n")
sys.stdout.flush()
def main():
last_req_id = 1000
for line in sys.stdin:
try:
req = json.loads(line)
method = req.get("method")
msg_id = req.get("id")
if not method and "result" in req:
# This is a response to one of our requests (like terminal/create)
result = req.get("result")
if "terminalId" in result: