BeautifulSoup库通俗来说是【解析、遍历、维护“标签树”(例如html、xml等格式的数据对象)的功能库 】
- 安装 BeautifulSoup 库
- 导包 from bs4 import BeautifulSoup
- 代码示例
-
def jinjianshenpi(self, url, brno, content, txcode): self.brNo = "<brNo>" + brno + "</brNo>" self.content = "<content>" + content + "</content>" self.txcode = "<txCode>" + txcode + "</txCode>" # url = "http://www.baidu.com/" # querystring = {"wsdl": ""} self.data = self.soupstart + self.brNo + self.content + self.reqDate + self.reqSerial + self.time + self.token + self.txcode + self.soupend logger.info('request content:'+self.content) res = requests.post(url, data=self.data.encode("gbk"), headers=self.headers, params=self.querystring) # 打