熊咪

爬虫学习----获取cookie

http://blog.csdn.net/samxx8/article/details/21535901

 

1.获取cookie

 

import urllib
import http.cookiejar
cookie = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie))
response = opener.open('http://www.weibo.com')
for item in cookie:
print ('Name = '+item.name)
print ('Value = '+item.value)

posted on 2015-05-14 19:09  熊咪  阅读(205)  评论(0编辑  收藏  举报