python 爬虫导入网页cookie self.cookie是网页cookie 返回结果不对

def get_cookie(self):
    self.cookie='''pt2gguin=o0873987836; RK=NVI1ao3BcZ; ptcz=cbc87e66473cf2948090147ba4e7cf5852f011e7f80502e7d1af2b3a885f6b59; pgv_pvid=4705218032; pgv_pvi=2274925568; o_cookie=873987836; pac_uid=1_873987836; tvfe_boss_uuid=01dd18e500423787; uin=o0873987836; qqmusic_uin=; qqmusic_key=; qqmusic_fromtag=; pgv_info=ssid=s3381266800; pgv_si=s7736142848; ADUSER_OPEN_ID=oQiT2t8y0FDtDOFSZvOqPCtv9wHA; agency_id=spid269f2af6d4; MMAD_TICKET=GPR+26NyuHTUovHsR/gSYqKY9nDi/5dX3MJY0yYsIfE9PT3ewecM1J+DXz8QcOToCsFGF9aX83E=; nickname=Stephen; nick_name=Stephen%F0%9F%8E%BB; headimgurl=http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJsCL1hJ8DjS66F3Cacnic71svYs0RWby0yHwTECiaQ4YmfSO2IN1D6Hibn9kCQWFHQMQ6ETzrkCsP4A/132; data_bizuin=1404072820; data_ticket=gylHiywCJs2+ihy0FvNNOWL+; skey=@Txqzq4OFu'''
    itemDict = {}
    items = self.cookie.split(';')
    for item in items:
        key = item.split('=')[0].replace(' ', '')
        value = item.split('=')[1]
        itemDict[key] = value
    return itemDict
def log_in(self):
    print self.get_cookie()
    requests.utils.add_dict_to_cookiejar(self.s.cookies, self.get_cookie())

    print self.s.cookies
    response =self.s.get(url='https://a.weixin.qq.com/cgi-bin/agency/getAgentAdMasterInfoList?cmdID=1&begin_time=1520352000&end_time=1520438340&from=1&page=1&page_size=10&name=&g_tk=828973434&_=1520408699025',headers=self.headers,cookies=self.get_cookie())
    

clipboard.png

    
    
    
    
    print response.text
阅读 2.5k
1 个回答

看看你的headers是什么样的

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题