国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

Python實現的金山快盤的簽到程序

2020-02-23 04:49:15
字體:
來源:轉載
供稿:網友

代碼如下:
__author__ = 'clownfish'
#coding:utf-8
import urllib2,urllib,cookielib,json

username = "快盤用戶名"
password = "快盤密碼"

class sign(object):
    username = ''
    password = ''
    #登錄顯示頁面
    indexurl = 'https://www.kuaipan.cn/account_login.htm'
    #登錄的form表單url
    loginurl = 'https://www.kuaipan.cn/index.php?ac=account&op=login'
    #簽到的真正url
    signurl = 'http://www.kuaipan.cn/index.php?ac=common&op=usersign'

    def __init__(self,username,password):
        self.username = username
        self.password = password

    def login(self):
        cj = cookielib.CookieJar()
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
        urllib2.install_opener(opener)
        print "打開登錄頁面"
        try:
            urllib2.urlopen(self.indexurl)
            post_data = {'username':self.username,'userpwd':self.password,'isajax':'yes'}
            req=urllib2.Request(self.loginurl,urllib.urlencode(post_data))
        except Exception, e:
            print "網絡鏈接錯誤"
            return False
        print "登錄成功,準備簽到!"
        response = urllib2.urlopen(req)
        login=response.read()
        return login

    def sign(self):
        response = urllib2.urlopen(self.signurl)
        sign = response.read()
        l = json.loads(sign)
        if (l and l['state'] == 1) or /
        (l and 0 == l['state'] and l['increase'] * 1 == 0 and l['monthtask'].M900 == 900):
            print "恭喜你簽到成功!"
            k = l['increase']*1
            m = l['rewardsize'] * 1
            if (k == 0 and l['monthtask'].M900 == 900):
                print "本月簽到積分已領取完成"

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 西昌市| 西充县| 三河市| 尉氏县| 深圳市| 南京市| 时尚| 都匀市| 勃利县| 镇远县| 镇江市| 江津市| 高邮市| 神农架林区| 临夏市| 抚顺市| 上虞市| 宁化县| 苍南县| 苏尼特右旗| 沁源县| 文昌市| 凌海市| 阜南县| 白朗县| 同仁县| 辽源市| 乡城县| 时尚| 台中市| 定兴县| 昌乐县| 清新县| 阳江市| 夹江县| 咸阳市| 巴彦淖尔市| 陇西县| 扶余县| 武宣县| 九龙坡区|