爬虫headers

from lxml import etree
import requests

url = "https://www.dytt8.net/html/gndy/dyzz/list_23_2.html"
headers = {
    'Connection':'close', #当请求成功后,马上断开该次请求(及时释放请求池中的资源)
    'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36'
}

发表评论