Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- import websockets
- URI = "-"
- TOKEN = "-"
- data = []
- async def main():
- async with websockets.connect(URI) as socket:
- msg = TOKEN
- await socket.send(msg)
- await listen(socket)
- async def listen(socket):
- msg = await socket.recv()
- if msg["kind"]!="data": ##todo actual conversion - i recieve a string lmao
- output = {"root":data}
- # save to a file
- await print(output)
- await socket.stop()
- else:
- data.append(msg["payload"])
- asyncio.run(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement