返回列表 发新帖

设置Cookie时一直显示invalid syntax怎么解决啊

[复制链接]

0

好友

2

主题

0

精华

终身VIP

积分
77
学分
110

终身VIP

发表于 2018-12-22 17:17:37 | 显示全部楼层 | 阅读模式
代码如下:
from urllib import request
dapeng_url ='http://www.renren.com/880151247/profile'
headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'
    'Cookie':'anonymid=jpz6hxcy-vfwcdh; depovince=ZGQT; _r01_=1; ick_login=ab59c364-d677-45aa-a90d-d475edf4a02a; t=1f8187657f9610c1f200d6561317d0719; societyguester=1f8187657f9610c1f200d6561317d0719; id=969200659; xnsid=2b0d31e7; jebecookies=fe14871c-1add-458d-83fb-648bd696c987|||||; ch_id=10016; jebe_key=d7440685-6b20-4192-b414-8e8bfd850417%7Cf5a7d4f0d76f04d8227f9f74e2d1a1f8%7C1545465946192%7C1%7C1545465943660'
}
req = request.Request(url=dapeng_url,headers=headers)
resp = request.urlopen(req)
with open('renren.html','w',encoding='utf-8') as fp:
    fp.write(resp.read().decode('utf-8'))

然后就一直提示
'Cookie' : 'anonymid=jpz6hxcy-vfwcdh; depovince=ZGQT; _r01_=1; ick_login=ab59c364-d677-45aa-a90d-d475edf4a02a; t=1f8187657f9610c1f200d6561317d0719; societyguester=1f8187657f9610c1f200d6561317d0719; id=969200659; xnsid=2b0d31e7; jebecookies=fe14871c-1add-458d-83fb-648bd696c987|||||; ch_id=10016; jebe_key=d7440685-6b20-4192-b414-8e8bfd850417%7Cf5a7d4f0d76f04d8227f9f74e2d1a1f8%7C1545465946192%7C1%7C1545465943660'}
             ^
SyntaxError: invalid syntax



快速回复 返回顶部 返回列表