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


Python Network.httpPostRequest方法代码示例

本文整理汇总了Python中Network.httpPostRequest方法的典型用法代码示例。如果您正苦于以下问题:Python Network.httpPostRequest方法的具体用法?Python Network.httpPostRequest怎么用?Python Network.httpPostRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Network的用法示例。


在下文中一共展示了Network.httpPostRequest方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [as 别名]
 def run(self):
     """Método que roda as funções bloqueantes da classe Servidor Bluetooth
     """
     while True:
         self.serverBlue.waitRequisition()
         self.room = self.serverBlue.receiveInformation()
         print("passei")
         params = {"nameRoom": self.room}
         util.httpPostRequest(self.ipResidence, 5432, "setRoomOfControl", params)
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:11,代码来源:ThreadBluetooth.py

示例2: exit

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [as 别名]
 def exit(self):
     """Método que encerra a conexão com Residência
     """
     params = {"nameRoom": self.room.getName()}
     try:
         print util.httpPostRequest(self.ipResidence, 5432, "removeRoom", params)
     except AttributeError:
         print "Parametros insuficientes"
     cherrypy.engine.exit()
     os._exit(0)
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:12,代码来源:server.py

示例3: powerEquipmentsNewRoom

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [as 别名]
    def powerEquipmentsNewRoom(self, roomConfiguration, nameRoom):
        """Método que liga os equipamentos do novo cômodo
        :Param data: Dicionário contendo os aparelhos e os comandos
        :Type data: Dicionário
        :Param nameRoom: Nome do novo cômodo
        :Type nameRoom: String
        """
        infoRoom = self.__searchRoom(nameRoom.lower())
        ip = infoRoom[0]
        port = infoRoom[1]

        params = {"configuration": str(roomConfiguration)}
        method = "setNewConfiguration"
        util.httpPostRequest(ip, port, method, params)
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:16,代码来源:Residence.py

示例4: notificaComodoControle

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [as 别名]
    def notificaComodoControle(self, nameRoom, status):
        """Método que notifica ao cômodo se o controle se encontra ou não dentro dele
        :Param nameRoom: Nome do cômodo
        :Type nameRoom: String
        :Param status: String do boolean correspondente a sua presença
        :Type status: String
        """
        infoRoom = self.__searchRoom(nameRoom.lower())
        print("Passandoo 1")
        if(infoRoom != False):
            ip = infoRoom[0]
            port = infoRoom[1]
            print("Passandoo 2")

            params = {"isFound" : status}
            method = "controlIsFound"
            
            print("Passandoo 3")
            util.httpPostRequest(ip, port, method, params)
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:21,代码来源:Residence.py

示例5: powerOffEquipmentsRoom

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [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

示例6: setRoomOfControl

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [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

示例7: cancelSleep

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [as 别名]
 def cancelSleep(self, nameRoom):
     """Método acessador de cômodos
     :Return: Cômodos mapeados pelos seus nomes
     :Rtype: Dicionário
     """
     
     nameRoom = nameRoom.lower()
     infoRoom = self.__searchRoom(nameRoom)
     if(infoRoom != False):
         ip = infoRoom[0]
         port = infoRoom[1]
         params = {}
         method = "cancelSleep"
         return util.httpPostRequest(ip, port, method, params)
     else:
         return "Comodo nao existe"
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:18,代码来源:Residence.py

示例8: sendCommand

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [as 别名]
 def sendCommand(self, nameRoom, equipment, command):
     """Método que envia os comandos para o cômodo
     :Param nameRoom: O nome do cômodo
     :Type nameRoom: String
     :Param equipment: O equipamento
     :Type equipment: String
     :Param command: O comando a ser executado
     :Type command: String
     :Return: A requisição Http Post do Cômodo
     :Rtype: Requisição Http Post
     """
     nameRoom = nameRoom.lower()
     infoRoom = self.__searchRoom(nameRoom)
     if(infoRoom != False):
         ip = infoRoom[0]
         port = infoRoom[1]
         params = {"equipment": equipment, "command": command}
         method = "controlEquipment"
         return util.httpPostRequest(ip, port, method, params)
     else:
         return "Comodo nao existe"
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:23,代码来源:Residence.py

示例9: Connect

# 需要导入模块: import Network [as 别名]
# 或者: from Network import httpPostRequest [as 别名]
 def Connect(self):
     """Método que faz a conexão com Residência
     """
     myIp = util.get_local_ip_address("1.1.1.1")
     print "mayyyyyyyyyyyyyyyyyyyyyyy0",util.get_local_ip_address("1.1.1.1")
     while True:
         port = self.room.getPort()
         if(port != None):
             print ("----------------------------My IP", myIp)
             params = {"nameRoom": self.room.getName(), "ip": myIp, "port": port}
             self.ipResidence = util.getResidenceIp()
             if (self.ipResidence == "Residence is offline"):
                 print "Residence is offline"
                 os._exit(1)
             print "sdssssssssssssss----------_",myIp,params,self.ipResidence
             sucessToCreatComod = util.httpPostRequest(self.ipResidence, 5432, "addRoom", params)
             if(sucessToCreatComod == False):
                 print "Problemas na conexao, tente novamente!"
                 os._exit(1)
             elif (sucessToCreatComod == "Comodo já existe"):
                 print "Nome de room existente, altere-o"
                 os._exit(1)
             break
     self.connected = True 
开发者ID:felipelindemberg,项目名称:ControleMultimidiaUniversal,代码行数:26,代码来源:server.py


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