SHARE
TWEET

MyEskom Python Script

sschocke Aug 8th, 2014 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2. import json
  3.  
  4. user = {'profileusername':"<username>", 'profilepassword': "<password>"}
  5. login = requests.post('https://www.myeskom.co.za/profile/login', data=user)
  6.  
  7. account_json = json.loads(login.text)
  8. success = 'data' in account_json
  9. if success == 0:
  10.     print account_json['message']
  11.     exit()
  12.  
  13. payload = {'authKey':account_json['data']}
  14. page = requests.post('https://www.myeskom.co.za/pages/Dashboard/24', data=payload)
  15.  
  16. json_decoded = json.loads(page.text)
  17.  
  18. print json_decoded['data']['page']['region']
  19. print json_decoded['data']['page']['status']
  20. print json_decoded['data']['page']['tmp']
  21. for appl in json_decoded['data']['page']['appliances']:
  22.     print appl['name']
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top