一、导入库
import requests
爬取网页通用框架
import requests
def getHTMLText(url1):
try:
r = requests.get(url1, timeout=30)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
except:
return "产生异常"
2024-03-18 21:56:04
一、导入库
import requests
爬取网页通用框架
import requests
def getHTMLText(url1):
try:
r = requests.get(url1, timeout=30)
r.raise_for_status()
r.encoding = r.apparent_encoding
return r.text
except:
return "产生异常"