这是一个创建于 5343 天前的主题,其中的信息可能已经有所发展或是发生改变。
以下是我的尝试,没有完成,谁能帮帮忙?
#!/usr/bin/python
# -*- coding: utf8 -*-
import re
import urllib
import urllib2
import cookielib
class Cnzz:
def __init__(self):
self.UserName=''
self.Password=''
self.cookie=cookielib.CookieJar()
self.opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie))
self.opener.addheaders=[('User-agent','Mozilla/5.0'),('Accept-Charset','gb2312')]
urllib2.install_opener(self.opener)
def login(self,username,password):
self.UserName=username
post_data=urllib.urlencode({'username':username,'password':password,'list':'1'})
path = 'http://www.cnzz.com/index.php'
req = urllib2.Request(url=path, data=post_data)
conn = urllib2.urlopen(req)
conn2 = urllib2.urlopen(urllib2.Request(url='http://new.cnzz.com/v1/main.php?s=site_list')).read()
return conn2
if __name__=="__main__":
cnzz=Cnzz()
y=cnzz.login('username','password')
print unicode(y,'utf-8','ignore').encode('gb2312','ignore')
6 条回复 • 1970-01-01 08:00:00 +08:00
 |
|
2
Alpha 2011 年 6 月 15 日
有没有朋友能指导下?
|
 |
|
3
c 2011 年 6 月 15 日
饿,没人帮你哇。吃晚饭帮你写一个吧!
|
 |
|
4
c 2011 年 6 月 15 日
|