Python xml.etree 模块,cElementTree() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用xml.etree.cElementTree()

项目:davscan    作者:Graph-X    | 项目源码 | 文件源码
def propfind(self,s,u, headers=None):
            print("[*] Sending PROPFIND request...")
        headers = s.headers
        if 'Depth' not in headers.keys():
            headers.update({'Depth': 'infinity'})
        r = s.request('PROPFIND', u, headers=headers)
        if r.status_code == 301:
        url = urlparse(r.headers['location'])
        return self.propfind(s,url.path)
            if r.status_code == 200 or r.status_code == 207:
                print("[*] Listing received.  Parsing XML. Depending on the size this might take a minute...")
                soup = bs(r.text, 'xml')
                return [r.status_code, soup]
            if r.status_code == 403:
                #trying again with depth 1
                headers.update({'Depth': '1'})
                print("[!] 403 Forbidden status code returned. Adjusting Depth header...")
                return self.propfind(s,u,headers)