SHARE
TWEET

Untitled

a guest Jul 21st, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import json
  2. import websockets
  3. import asyncio
  4.  
  5.  
  6. async def test():
  7.     uri = "ws://192.168.8.139:8765"
  8.     async with websockets.connect(uri) as websocket:
  9.         data = {"jsonrpc": "2.0",
  10.                 "method": "get_all_volunteers",
  11.                 "params": [],
  12.                 "id": 0}
  13.  
  14.         await websocket.send(json.dumps(data))
  15.  
  16.         res = await websocket.recv()
  17.         print(f"Recieve: {res}")
  18.  
  19. asyncio.get_event_loop().run_until_complete(test())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top