Advertisement
Guest User

Untitled

a guest
Oct 30th, 2017
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import json
  2. import requests
  3. from requests.auth import HTTPDigestAuth
  4.  
  5.  
  6. envoy_ip = 'ip'
  7. envoy_user = 'envoy'
  8. envoy_password = 'last6digitsofserial'
  9. productionTableString = '/api/v1/production/inverters/'
  10. url = 'http://' + envoy_ip + productionTableString
  11.  
  12. def read_envoy_data(envoy_ip, envoy_user, envoy_password):
  13.     response = requests.get(url, auth=HTTPDigestAuth(envoy_user, envoy_password))    
  14.     data = json.loads(response.text)
  15.     return data
  16.  
  17. def main():
  18.     data = read_envoy_data(envoy_ip, envoy_user, envoy_password)
  19.     for item in data:
  20.         print item['lastReportWatts']
  21. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement