码迷,mamicode.com
首页 > 编程语言 > 详细

Python--格式化cookie为字典类型

时间:2018-02-09 20:28:33      阅读:1514      评论:0      收藏:0      [点我收藏+]

标签:user   https   gpo   on()   cti   page   com   get   web   

import requests

cookies = ‘dy_did=d94fe220c9ac1c014987ec5e00061501; _dys_refer_action_code=init_page_studio_v; acf_yb_auth=e5a8f675af47acaeaf434cad94061d119ee35ab6; acf_yb_new_uid=OVAOGxPZJAQk; acf_yb_uid=23577717; wan_auth37wan=e905f01aeff1ABnq4XOGY5v7evce6pDdBQF3bnaqgNPpVsAJYE%2Fw4JINiGuP%2Br1fw%2FUMRHDUlCFbvgsjHZhXe1ZgiiS5zU2oAxPzLfBb8VGnznzflQ; smidV2=201802071500113f502a3e75dea9ef6790f8a6a89a4d7a004fe7c47bd11b8b0; Hm_lvt_e99aee90ec1b2106afe7ec3b199020a7=1517977429,1517980745,1517984460,1517985641; Hm_lpvt_e99aee90ec1b2106afe7ec3b199020a7=1517993736; Hm_lvt_e0374aeb9ac41bee98043654e36ad504=1517984538,1517984544,1517984752,1517985645; Hm_lpvt_e0374aeb9ac41bee98043654e36ad504=1517993742; acf_yb_t=2CXdVSPU2x9KSccGsaHmGOp14pZSnrUj‘
lists = cookies.split(‘;‘)
cookie = {}
for i in lists:
j = i.strip()
j = j.split(‘=‘)
cookie[j[0]] = j[1]

url = r‘https://yuba.douyu.com/wbapi/web/user/followList/5748?page=1&limit=20&timestamp=0.9136645394‘
data = {‘page‘: 1, ‘limit‘: 20}

r = requests.get(url, data, cookies=cookie)

print(r.json())

Python--格式化cookie为字典类型

标签:user   https   gpo   on()   cti   page   com   get   web   

原文地址:https://www.cnblogs.com/wangsilei/p/8436039.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!