Python获取xml数据

def get_store(self,):
    try:
        resp=session.get(url=self.base_url,headers=self.headers,verify=False).content.decode()
        result = etree.XML(resp)
        self.data_list=result.xpath('//shop/@v')
        logging.info(self.data_list)
    except Exception:
        traceback.print_exc()
posted @ 2020-05-27 14:53  hank-li  阅读(632)  评论(0编辑  收藏  举报