-
Notifications
You must be signed in to change notification settings - Fork 1
/
examples.py
36 lines (32 loc) · 933 Bytes
/
examples.py
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
27
28
29
30
31
32
33
34
35
36
import asyncio
import sys
from linktap import LinkTap
async def main():
username = sys.argv[1]
apiKey = sys.argv[2]
lt = LinkTap.LinkTap(username, apiKey)
all_devices = lt.get_all_devices()
if all_devices == "error":
print("all_devices - error")
LOGGER.info(
"get_link_tap_devices: The minimum interval of calling this API is 5 minutes."
)
data = None
ready = False
return False
elif all_devices is None:
print("all_devices - none")
LOGGER.info("Get all devices failed")
data = None
ready = False
return False
else:
print("no error detected")
data = all_devices
print(data)
ready = True
return True
if __name__ == "__main__":
print("Starting main")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())