Cookie的处理分割
import time
import requests
url = "https://bbs.zhulong.com/101020_group_200201/detail42941862/"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
}
cookie = "fno=1; eduumuid=630b3147106f5728fb96a658c271dd3b; pcid=11174388; Hm_lvt_cdf7318ce2f5dc58e89bb436a5989912=1614915688,1614932269,1614933934,1614935760; Hm_lvt_d165b0df9d8b576128f53e461359a530=1614915688,1614932270,1614933935,1614935761; CNZZDATA5078536=cnzz_eid%3D1135777904-1614828326-https%253A%252F%252Fwww.zhulong.com%252F%26ntime%3D1614991764; redirecturl=https%3A//www.zhulong.com/; CNZZDATA1633628=cnzz_eid%3D634588927-1614830413-https%253A%252F%252Fwww.zhulong.com%252F%26ntime%3D1614992540; ZLID=4935nfxFYQbWoCW3V6BWwSw4X-FvxcWvuuXLaQwrR8dkfQ1nCmQY-kT99p6Rc3EP; uid=11174388; username1=%CE%E5%C3%D7123; isCorp=0; username=%E4%BA%94%E7%B1%B3123; specialty_id=1; Hm_lvt_49541358a94eea717001819b500f76c8=1614932269,1614933934,1614935760,1614995467; UM_distinctid=178053bcfed7ba-013b811cddd2ee-c791039-1fa400-178053bcfeec08; userid=11174388; token=dXNlcmlkPTExMTc0Mzg4JmFjdGl2YXRlPTE%3D.428117e4529d5dc69ad023bee772c55b.1615600310; active_202136=1; PHPSESSID=3c0bba536954bb7bb2c2052f8c0d0c6a; Hm_lpvt_cdf7318ce2f5dc58e89bb436a5989912=1614995541; Hm_lpvt_49541358a94eea717001819b500f76c8=1614995541; Hm_lpvt_d165b0df9d8b576128f53e461359a530=1614995542"
cookies = {i.split("=")[0]:i.split("=")[-1] for i in cookie.split("; ")}
res = requests.get(url=url,headers = headers,cookies = cookies,allow_redirects=False)
print(res.text,res.status_code)