plugin.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:sonos 作者: gerard33 项目源码 文件源码
def sendMessage(self, data, method, url):
        conn = http.client.HTTPConnection(Parameters["Address"] + ":1400")
        headers = {"Content-Type": 'text/xml; charset="utf-8"', "SOAPACTION": method}
        conn.request("POST", url, data, headers)
        response = conn.getresponse()
        conn.close()

        if response.status == 200:
            data = response.read().decode("utf-8")
            LogMessage(str(data))
            self.parseMessage(data)
        else:
            Domoticz.Error("Unexpected response status received in function sendMessage (" + str(response.status) + ", " + str(response.reason) + "). \
                            The following command is sent: " + str(method) + ", " + str(url))
        return

    # Process message from Sonos
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号