Working async AllWatcher example
[osm/N2VC.git] / examples / allwatcher.py
1 import asyncio
2
3 from juju.client.connection import Connection
4 from juju.client import watcher
5
6
7 loop = asyncio.get_event_loop()
8 conn = loop.run_until_complete(Connection.connect_current())
9
10
11 async def watch():
12 allwatcher = watcher.AllWatcher()
13 allwatcher.connect(conn)
14 while True:
15 change = await allwatcher.Next()
16 for delta in change.deltas:
17 print(delta.deltas)
18
19 loop.run_until_complete(watch())