Skip to content

Instantly share code, notes, and snippets.

@AlJohri
Created December 4, 2014 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlJohri/9830e227ea0fb2683dea to your computer and use it in GitHub Desktop.
Save AlJohri/9830e227ea0fb2683dea to your computer and use it in GitHub Desktop.
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