python 登陆 gfan打卡,pythongfan,学习python,搞了个
python 登陆 gfan打卡,pythongfan,学习python,搞了个
学习python,搞了个打卡程序。欢迎多提意见!
import urllib import urllib2 import cookielib import md5def login(): hosturl='http://bbs.gfan.com' posturl='''http://bbs.gfan.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1''' cj=cookielib.LWPCookieJar() cookie_support=urllib2.HTTPCookieProcessor(cj) opener=urllib2.build_opener(cookie_support,urllib2.HTTPHandler) urllib2.install_opener(opener) h=urllib2.urlopen(hosturl) pwd=md5.new('*********') pp=pwd.hexdigest() headers={'Host':'bbs.gfan.com','User-Agent':"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",} postData={'fastloginfield':'username','username':'********','password':pp,'quickforward':'yes','handlekey':'ls', 'Referer':"http://bbs.gfan.com/forum.php"} postData=urllib.urlencode(postData) request=urllib2.Request(posturl,postData,headers) print request response=urllib2.urlopen(request) #text=response.read() dakaurl="http://bbs.gfan.com/home.php?mod=task&do=apply&id=43" #dakaurl="http://bbs.gfan.com/home.php?mod=task&do=view&id=43" daka=urllib2.urlopen(dakaurl) dd=daka.read() print dd fp=open('c:/test.html','a+') fp.write(dd) fp.close()if __name__ == '__main__': login() #login() print "Login in bbs.gfan.com"#该片段来自于http://byrx.net
相关内容
- 创建一个简单的电话本,支持添加和查询功能,创建查
- 在文本中,批量搜索信息,文本搜索信息,在C:\盘下面创
- darkBing SQL扫描器,darkbingsql扫描器,#!/usr/bin/p
- python获取网页状态码,python获取网页,#coding=utf-
- KMP的python实现,KMPpython实现,KMP算法的精髓在于,在
- 批量下载51voa的文本和MP3,51voa文本mp3,test.py 文件 测
- python对机器的网页服务器进行拒绝服务攻击,python拒绝
- 简易银行ATM存取款系统,atm存取款,ID = 999PASS
- python 视频下载,python,将视频网站的视频从chr
- ip地址转换成整数,ip地址整数,#!/bin/env p
评论关闭