lovespeech/client/entrypoint.py
2024-09-29 09:24:47 +02:00

20 lines
485 B
Python
Executable file

#!/usr/bin/env python
import os
import asyncio
from websockets.asyncio.client import connect
async def test():
uri = "ws://server:1080"
async with connect(uri) as websocket:
print(f"Get username via:\n name = os.environ.get('USER')")
msg = os.environ.get('USER')
await websocket.send(msg)
print(f"SENT: {msg}")
answer = await websocket.recv()
print(f"RECVEIVED: {answer}")
if __name__ == "__main__":
asyncio.run(test())