#! /usr/bin/env python
#coding=utf-8
import urllib2
import urllib
import cookielib
data={"email":"heshang@sina.com","password":"yao"} #输入自己的登陆用户名和密码
post_data=urllib.urlencode(data)
cj=cookielib.CookieJar()
opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
headers ={"User-agent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1"}
req=urllib2.Request("",post_data,headers)
content=opener.open(req)
print content.read()
#.decode("utf-8").encode("gbk")
代码出自http://blog.javachen.com/2014/03/18/simulate-weibo-login-in-python/
阅读(804) | 评论(0) | 转发(0) |