denonavr.py 文件源码

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

项目:denonavr 作者: scarface-4711 项目源码 文件源码
def get_status_xml(self, command):
        """Get status XML via HTTP and return it as XML ElementTree."""
        # Get XML structure via HTTP get
        res = requests.get("http://{host}{command}".format(
            host=self._host, command=command), timeout=self.timeout)
        # Continue with XML processing only if HTTP status code = 200
        if res.status_code == 200:
            try:
                # Return XML ElementTree
                return ET.fromstring(res.text)
            except ET.ParseError:
                _LOGGER.error(
                    "Host %s returned malformed XML for: %s",
                    self._host, command)
                raise ValueError
        else:
            _LOGGER.error((
                "Host %s returned HTTP status code %s "
                "when trying to receive data"), self._host, res.status_code)
            raise ValueError
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号