cookie 转dict


cookie 转dict

from http.cookies import SimpleCookie
rawdata = """
JSESSIONID=867C9C59CA63A01545CAD001334E6CDB; Hm_lvt_62d92d99f7c1e7a31a11759de376479f=1560419858,1560428313,1560429324,1560429869; ymtinfo=eyJ1aWQiOiIzODU2MzA0IiwicmVzb3VyY2UiOiIiLCJhcHBfbmFtZSI6IiIsImV4dF92ZXJzaW9uIjoiMSJ9; _pk_ref.3.a971=%5B%22%22%2C%22%22%2C1560430099%2C%22http%3A%2F%2Fwww.medlive.cn%2Fauth%2Flogin%3Fservice%3Dhttp%253A%252F%252Fmeddic.medlive.cn%252Fsearch%252FsearchSciTwoSentences.do%253Fpage%253D6%2526keyword%253D%2525E4%2525B8%252580%22%5D; _pk_ses.3.a971=*; ymt_pk_id=e3e9c4891e62c546; Hm_lpvt_62d92d99f7c1e7a31a11759de376479f=1560430109; _pk_id.3.a971=e3e9c4891e62c546.1560430099.1.1560430109.1560430099.
"""
cookie = SimpleCookie(rawdata)
cookies = {i.key:i.value for i in cookie.values()}
cookies