23 lines
503 B
Python
23 lines
503 B
Python
import asyncio
|
|
import socketio
|
|
|
|
|
|
sio = socketio.AsyncClient()
|
|
|
|
@sio.on('state')
|
|
def sio_state(state):
|
|
print(state)
|
|
|
|
@sio.on('identified')
|
|
def sio_identified(msg):
|
|
if msg.get('identified') != True:
|
|
print('COULD NOT IDENTIFY')
|
|
return
|
|
print('Identified.')
|
|
|
|
async def main():
|
|
cl = await sio.connect('http://127.0.0.1:5000')
|
|
await sio.emit('admin', {'password': 'changeme', 'set_role': {'who': '716a784c', 'what': 'HOST'}})
|
|
await asyncio.sleep(2)
|
|
|
|
asyncio.run(main())
|