ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

pyhon 字典表达式处理cookies headers

2021-10-14 03:31:21  阅读:32  来源: 互联网

标签:cookies pyhon cache headers sec split Hm match


###

# headers处理
headers = """Host:match.yuanrenxue.com
content-length: 0
pragma: no-cache
cache-control: no-cache
sec-ch-ua: "Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36
sec-ch-ua-platform: "macOS"
accept: */*
origin: https://match.yuanrenxue.com
sec-fetch-site: same-origin
sec-fetch-mode: cors
sec-fetch-dest: empty
referer: https://match.yuanrenxue.com/match/3
accept-encoding: gzip, deflate, br
accept-language: zh-CN,zh;q=0.9
cookie: sessionid=2mzsjq18db00jmf6lau5xj03xqqg2crs"""

print({i.split(":")[0]:i.split(":")[1] for i in headers.split("\n")})

 

###

# cookie处理cookies = "m_lvt_0362c7a08a9a04ccf3a8463c590e1e2f=1633781879,1633781893; Hm_lpvt_0362c7a08a9a04ccf3a8463c590e1e2f=1633781911; Hm_lvt_c99546cf032aaa5a679230de9a95c7db=1634005743; Hm_lvt_9bcbda9cbf86757998a2339a0437208e=1634005743; no-alert3=true; tk=5367912763121426793; sessionid=azgdtwa3crbnouovyr5nk1uro4l3ng6i; Hm_lpvt_9bcbda9cbf86757998a2339a0437208e=1634086125; Hm_lpvt_c99546cf032aaa5a679230de9a95c7db=1634086126"print({i.split("=")[0]:i.split("=")[1] for i in cookies.split("; ")})

 

 

 

####

 

 

 

 

###

标签:cookies,pyhon,cache,headers,sec,split,Hm,match
来源: https://www.cnblogs.com/andy0816/p/15404991.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有