Skip to content

Instantly share code, notes, and snippets.

@dmarkey
Created December 8, 2017 22:41
Show Gist options
  • Save dmarkey/2a6c5bcde12fd03ca1e2fe57c824761e to your computer and use it in GitHub Desktop.
Save dmarkey/2a6c5bcde12fd03ca1e2fe57c824761e to your computer and use it in GitHub Desktop.
This is a example of scraping the Irish PhoneWatch "mypages" to establish the temperature of the sensors in the house (not updated that often)
import requests
s = requests.Session()
s.post("https://mypages.phonewatch.ie/User/Login", {"userId": EMAIL, "password": PASSWORD})
panels = [ panel['PanelId'] for panel in s.get("https://mypages.phonewatch.ie/Panel/GetPanelList").json()]
sensors = sum([ s.get("https://mypages.phonewatch.ie/Panel/GetTempratures/{}".format(panel)).json() for panel in panels], [])
for sensor in sensors:
print("Sensor {} has temperature {}".format(sensor['Label'], sensor['Temprature']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment