INNER CODE UNIT · Python

send_notification

SpartanJ/eepp · projects/scripts/acp_mock_agent.py:5

def send_notification(method, params):
    msg = {"jsonrpc": "2.0", "method": method, "params": params}
    sys.stdout.write(json.dumps(msg) + "\n")
    sys.stdout.flush()

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")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…