-
Notifications
You must be signed in to change notification settings - Fork 11
/
test.py
30 lines (28 loc) · 886 Bytes
/
test.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
import sys
import time
from connection import Connection
from userservice import UserService
from vehicleservice import VehicleService
if __name__ == "__main__":
if len(sys.argv) < 3:
print "Usage: %s username password" % sys.argv[0]
exit(2)
c = Connection(sys.argv[1], sys.argv[2])
u = UserService(c)
print "logging in..."
d = u.login_and_get_status()
if not c.logged_in:
print "Log in invalid, please try again"
else:
vin = d.user_info.vin
print "logged in, vin: %s, nickname: %s" % (vin, d.user_info.nickname)
v = VehicleService(c)
print "requesting status..."
v.request_status(vin)
print "sleeping for 20 seconds..."
time.sleep(20)
print "getting latest..."
d = u.get_latest_status(vin)
print "done!"
import yaml
print yaml.dump(d)