浏览器复制的headers头简易处理

text = """
Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:zh-CN,zh;q=0.9
Connection:keep-alive
Content-Length:51
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Cookie:_did=web_205909481A8B9441; isCloseVisit=false; sign_remind=1; did=H5_FfPrSNoWkMALtGX81ItlOHaatrfsU; did.sig=So9pY5zaR5TDoLVHaeJonVI_dv_LrhFDfvLPdHXDF6A; ac__avi=101055342091f15ea2eccc9b4bb28033e3881e7ea61b1002819658b692ccc65b40c5f089d7bf9e2350; ac_username=peimin1; ac_userimg=http%3A%2F%2Fcdn.aixifan.com%2Fdotnet%2F20120923%2Fstyle%2Fimage%2Favatar.jpg; XSRF-TOKEN=eyJpdiI6IkpnNFN4TjZjeGRkRnBzSnFOK0NHVGc9PSIsInZhbHVlIjoieWh3akpKNUsyRlQzaUExb0kxdElPTUR6K0tuU0J6XC9xMlFWazVYbXh2QjFtMDVyTVRFU2hKUXNhYUppaTJxTEh5UG50eldsU0g3VjNxbkRnNUtLa2lRPT0iLCJtYWMiOiI1Yjg3OGYyOWI3MDU4MTFmZmU0OTkwNDk2ZmFjMDgzMDY2MTA2NGVlZjNhYmM3ZDBlZTVhNzRlODYwOWNjZWFiIn0%3D; ap_session=eyJpdiI6InVlYXA0ZkpNR0UrbWFHTGNyRTBKWHc9PSIsInZhbHVlIjoib3p1OXlBYUNJcmJaOUc0WUl4VGxsSE8wNk1cL1VwbGFQb3ZZSUpxenZ6ekJMcVNCb0wxMTluOVJaZGFcL1o5cVkzcWpIODhNUnl5cXBISjhVRHdGeEpqZz09IiwibWFjIjoiMTA4MzQyMzQ4ZWE4YWEyYjljNGMxZGI5ODI4ZGNiOTgzMmIxMDFjYjA5MThlMzcyYzc4Yzc5NDUzYzc1ZDllOCJ9; Hm_lvt_2af69bc2b378fb58ae04ed2a04257ed1=1552394219,1552481007,1552565876,1552572881; Hm_lpvt_2af69bc2b378fb58ae04ed2a04257ed1=1552575772
Host:id.app.acfun.cn
Origin:http://www.acfun.cn
Referer:http://www.acfun.cn/login/?returnUrl=http%3A%2F%2Fwww.acfun.cn%2F
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36
        """

import re

info = dict()
for i, j in re.findall('(.*?):(.*)\\n', text):
    info[i] = j

print(info)

你可能感兴趣的:(浏览器复制的headers头简易处理)