Created
December 4, 2014 20:28
-
-
Save AlJohri/9830e227ea0fb2683dea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, requests | |
# set username and password as environment variables before running this script | |
# export USERNAME='' | |
# export PASSWORD='' | |
s = requests.Session() | |
response = s.post("https://www.lacrossealerts.com/login/", data={'username': os.getenv('USERNAME'), 'password': os.getenv('PASSWORD')}) | |
serials = { | |
"000117CF1EF2E338": "Server Room Temp", | |
"000148E8D239572E": "Gross Room Temp", | |
"0001B66C52936B72": "Block Room Temp" | |
} | |
GET_HISTORY = False | |
NUM_DAYS = -7 | |
# Download observation(s) for each device | |
for serial in serials.keys(): | |
if GET_HISTORY: | |
response = s.get("http://www.lacrossealerts.com/v1/observations/?serial=%s&form=%ddays&format=json" % (serial, NUM_DAYS)) | |
else: | |
response = s.get("http://www.lacrossealerts.com/v1/observations/?serial=%s&format=json" % serial) | |
print response.json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment