本文整理汇总了Python中Network.httpGetRequest方法的典型用法代码示例。如果您正苦于以下问题:Python Network.httpGetRequest方法的具体用法?Python Network.httpGetRequest怎么用?Python Network.httpGetRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network.httpGetRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getRooms
# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpGetRequest [as 别名]
def getRooms(self):
if (self.ipResidence == None):
self.ipResidence = util.getResidenceIp()
if (self.ipResidence != "Residence is offline"):
tmp = util.httpGetRequest(self.ipResidence, 5432,"getRooms")
self.rooms = json.loads(tmp).keys()
else:
self.ipResidence = None
示例2: powerOffEquipmentsRoom
# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpGetRequest [as 别名]
def powerOffEquipmentsRoom(self):
"""Método que desliga todos os equipamentos do cômodo
"""
for roomTemp in self.rooms.items():
print("---------------------------------", roomTemp)
nameRoomTemp = roomTemp[0]
ipRoomTemp = roomTemp[1][0]
portRoomTemp = roomTemp[1][1]
method = "getNumberOfPeoples"
result = util.httpGetRequest(ipRoomTemp, portRoomTemp, method)
if(result == False):
self.removeRoom(nameRoomTemp)
elif(result == "0"):
params = {"equipment": "all", "command": "poweroff"}
method = "controlEquipment"
util.httpPostRequest(ipRoomTemp, portRoomTemp, method, params)
time.sleep(15)
self.powerOffEquipmentsRoom()
示例3: setRoomOfControl
# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpGetRequest [as 别名]
def setRoomOfControl(self, nameRoom):
"""Método que modifica o cômodo a ser controlado
:Param nameRoom: Nome do cômodo
:Type nameRoom: String
:Return: String referente a modificação
:Rtype: String
"""
oldRoomOfControl = self.roomOfControl
nameRoom = nameRoom.lower()
if((nameRoom != self.roomOfControl) and (nameRoom in self.rooms.keys())):
self.roomOfControl = nameRoom
self.notificaComodoControle(self.roomOfControl, "True")
if(oldRoomOfControl != None):
self.notificaComodoControle(oldRoomOfControl, "False")
infoRoom = self.__searchRoom(oldRoomOfControl.lower())
if(infoRoom != False):
ip = infoRoom[0]
port = infoRoom[1]
print("---------------ip e port", ip, port)
method = "getRoomConfiguration"
roomConfiguration = util.httpGetRequest(ip, port, method)
print("------------------------------ satatsus" ,roomConfiguration)
if(roomConfiguration != False): #trocar pára diferente
roomConfiguration = json.loads(roomConfiguration)
self.powerEquipmentsNewRoom(roomConfiguration, nameRoom)
print ("devo ligar todos os equipamentos")
print("+++++++++++++++++++++++", type(roomConfiguration), roomConfiguration)
params = {"equipment": "all", "command":"poweroff"}
method = "controlEquipment"
util.httpPostRequest(ip, port, method, params)
#print ("desligar os comodos do quarto antigo caso não tenha pessoas", ip, port)
return "Local alterado"
return "Comodo nao existe"