-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathtest.py
More file actions
32 lines (20 loc) · 706 Bytes
/
test.py
File metadata and controls
32 lines (20 loc) · 706 Bytes
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
import pprint
import time
from ambient_api.ambientapi import AmbientAPI
weather = AmbientAPI(log_level='CONSOLE')
def test_endpoint():
assert weather.endpoint == 'https://rt.ambientweather.net/v1'
devices = weather.get_devices()
def test_devices():
assert len(devices) == 0
for device in devices:
# Wait two seconds between requests so we don't get a 429 response.
# https://ambientweather.docs.apiary.io/#introduction/rate-limiting
# This probably won't happen much in real world situations.
time.sleep(2)
print('Device')
print((str(device)))
print('Last Data')
pprint.pprint(device.last_data)
print('Get Data')
pprint.pprint(device.get_data())