Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Skip to content
- This repository
- Pull requests
- Issues
- Gist
- @sudo-Whateverman
- One of our mostly harmless robots seems to think you are not a human.
- Because of that, it’s hidden your profile from the public. If you really are human, please contact support to have your profile reinstated.
- We promise we won’t require DNA proof of your humanity.
- 1
- 0
- 0
- sudo-Whateverman/DumbPolluting
- DumbPolluting/RDMwriter.py
- @sudo-Whateverman sudo-Whateverman 4 minutes ago version good
- 1 contributor
- 75 lines (62 sloc) 2.488 kB
- __author__ = 'nick'
- from suds.client import Client
- from suds.plugin import *
- url = 'http://director.resourcedm.com/cgi-bin/cgi.cgi?WSDL'
- # url ='http://10.1.2.75/cgi-bin/cgi.cgi?wsdl'
- def getWSDLconnection(url):
- # This function will prompt the user to enter the wsdl link, can be used from commandline or use the default value
- # default is http://director.resourcedm.com/cgi-bin/cgi.cgi?WSDL
- client = Client(url)
- return client
- def genPointLinks():
- # will write the additional data needed to write a script
- return 0
- def genHttpPoints():
- # will write the HTTP retriever point with a regex to read the data from shufersal;
- return 0
- def generateupdateStatement():
- # creates a string for setting the value using a point link
- return 0
- def genNames(client):
- # Genereates a list of Equip/point and its corresponding value to pass to a higher function
- NameList = []
- Slaves = client.service.GetSlaveList().Slave
- for i in range(len(Slaves)):
- # print Slaves[i].Name
- try:
- Points = client.service.GetSlave(Slaves[i].Name).Items.Item
- except AttributeError:
- print Slaves[i].Name + " has no Items to list"
- else:
- for j in range(len(Points)):
- NameList.append(
- [str(Slaves[i].Name + '/' + Points[j].Name), str(Points[j].Value), str(Points[j].Units)])
- # print str(Slaves[i].Name + '/' + Points[j].Name) +" : "+ str(Points[j].Value) + str(Points[j].Units)
- return NameList
- def genCredentials(client,username,password):
- userCred = client.factory.create('UserCredentials')
- userCred.UserName = username
- userCred.Password = password
- client.set_options(soapheaders=userCred)
- def writeSlave(Name,point_struct):
- points = client.factory.create('ArrayOfSettings')
- points.Setting = client.factory.create('Setting')
- points.Setting.Name = point_struct.Name
- points.Setting.Value = point_struct.Value
- client.service.SetSlave(Name,points)
- client = getWSDLconnection(url)
- Slaves = client.service.GetSlaveList()
- # HVAC1 = Slaves.Slave[1]
- inp2 = Slaves.Slave[0]
- points = client.service.GetSlave(inp2.Name)
- # off6 = points.Items.Item[-5]
- genCredentials(client,username='igor',password='1111')
- settables = []
- for setpoint in points.Items.Item:
- try :
- writeSlave(inp2.Name,setpoint)
- except WebFault , e :
- print e
- else:
- settables.append(setpoint.Name)
- print(settables)
- Status API Training Shop Blog About Pricing
- © 2015 GitHub, Inc. Terms Privacy Security Contact Help
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement