当前位置: 首页>>代码示例>>Python>>正文


Python Network.httpGetRequest方法代码示例

本文整理汇总了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
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:10,代码来源:run.py

示例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()
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:22,代码来源:Residence.py

示例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"
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:38,代码来源:Residence.py


注:本文中的Network.httpGetRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。