FoscamHD2.py 文件源码

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

项目:camera-polyglot 作者: jimboca 项目源码 文件源码
def _http_get_and_parse(self, cmd, payload = {}):
        """ 
        Call http_get and parse the returned Foscam data into a hash.  The data 
        all looks like:  var id='000C5DDC9D6C';
        """
        ret  = {}
        data = self._http_get(cmd,payload)
        self.parent.logger.debug("FoscamHD2:_http_get_and_parse:%s: data=%s" % (self.name,data))
        if data is False:
            code = -1
        else:
            # Return code is good, unless CGI result changes it later
            code = 0
            root = ET.fromstring(data)
            for child in root.iter():
                if child.tag == 'result':
                    code = int(child.text)
                elif child.tag != 'CGI_Result':
                    ret[child.tag] = child.text
        self.parent.logger.debug("FoscamHD2:_http_get_and_parse:%s: code=%d, ret=%s" % (self.name,code,ret))
        return code,ret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号