Created
December 8, 2017 22:41
-
-
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)
This file contains 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 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