''' 时间:2020/10/28 功能:初始化session 目录: 一: headers 二: cookies '''
一: headers
# 初始化 - headers header = { "Connection": "keep-alive", "Accept":"application/json, text/plain, */*", "DNT": "1", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36", "Accept-Language": "zh-CN,zh;q=0.9", } s.headers.update(header)
二: cookies
# 初始化 - cookies c = requests.cookies.RequestsCookieJar() c.set(".CNBlogsCookie", "006077989322E3") c.set(".Cnblogs.AspNetCore.Cookies", "FE49845C8637CF6036E1") s.cookies.update(c)