File: bpup_test.py

package info (click to toggle)
python-bond-async 0.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: python: 1,537; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 572 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import asyncio
import logging

from bond_async import BPUPSubscriptions, start_bpup


async def main(ip_address):
    """Example of library usage."""

    sub = BPUPSubscriptions()
    stop_bpup = await start_bpup(ip_address, sub)

    for i in range(500):
        print("BPUP is alive:", sub.alive)
        await asyncio.sleep(1)

    stop_bpup()


if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG)

    print("Enter the device ip:")
    ip_address = input().strip()
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main(ip_address))