-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
sample.py
40 lines (30 loc) · 940 Bytes
/
sample.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
37
38
39
40
"""Sample file."""
import asyncio
from pylitterbot import Account
# Set email and password for initial authentication.
username = "Your username"
password = "Your password"
async def main():
"""Run main function."""
# Create an account.
account = Account()
try:
# Connect to the API and load robots.
await account.connect(
username=username, password=password, load_robots=True, load_pets=True
)
# Print robots associated with account.
print("Robots:")
for robot in account.robots:
print(robot)
print("Pets:")
for pet in account.pets:
print(pet)
weight_history = await pet.fetch_weight_history()
for weight in weight_history:
print(weight)
finally:
# Disconnect from the API.
await account.disconnect()
if __name__ == "__main__":
asyncio.run(main())