oss_xml_handler.py 文件源码

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

项目:mongodb_backup_script 作者: hxt168 项目源码 文件源码
def __init__(self, xml_string):
        self.xml_unescape_table = {}
        self.xml_map = {}
        try:
            self.xml = minidom.parseString(xml_string)
        except:
            print xml_string
            self.xml_unescape_tabl = get_xml_unescape_table()
            self.xml_map = get_xml_unescape_map()
            for k, v in self.xml_map.items():
                xml_string = xml_string.replace(k, v)
            self.xml = minidom.parseString(xml_string)
        self.bucket = get_tag_text(self.xml, 'Bucket', convert_to_bool = False)
        self.object = get_tag_text(self.xml, 'Key', convert_to_bool = False)
        if self.xml_map:
            for k, v in self.xml_map.items():
                self.object = self.object.replace(v, k)
            self.object = unescape(self.object, self.xml_unescape_table)
        self.key = get_tag_text(self.xml, 'Key', convert_to_bool = False)
        self.upload_id = get_tag_text(self.xml, 'UploadId')
        self.marker = get_tag_text(self.xml, 'Marker', convert_to_bool = False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号