#!/usr/bin/env python import asyncio import os from websockets.asyncio.client import connect async def hello(): uri = "ws://server:1080" async with connect(uri) as websocket: print(f"Get username via:\n name = os.environ.get('USER')") name = os.environ.get('USER') # name = name == NULL ? std::string() : std::string(name); await websocket.send(name) print(f">>> {name}") greeting = await websocket.recv() print(f"<<< {greeting}") if __name__ == "__main__": asyncio.run(hello())