欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python實現(xiàn)的金山快盤的簽到程序

 更新時間:2013年01月17日 00:43:48   作者:  
正在學(xué)習(xí)python而且自己一直在用金山快盤,所以就寫來個簽到的功能,每天定時跑

復(fù)制代碼 代碼如下:

__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 "網(wǎng)絡(luò)鏈接錯誤"
            return False
        print "登錄成功,準(zhǔn)備簽到!"
        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 "本月簽到積分已領(lǐng)取完成"
            else:
                print "簽到獎勵積分:%s" % (k)
            if m == 0:
                print "手氣太不好了!獎勵 0M 空間"
            else:
                print "簽到獎勵空間:%s" % (m)
        else:
            if (l['state'] == -102):
                print "今天您已經(jīng)簽到過了"
            else:
                print "簽到失敗,遇到網(wǎng)絡(luò)錯誤,請稍后再試!"

        return sign


if __name__ == "__main__":
    sign = sign(username,password)
    if sign.login():
        sign.sign()

相關(guān)文章

  • python openpyxl使用方法詳解

    python openpyxl使用方法詳解

    這篇文章主要介紹了python openpyxl使用方法詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2019-07-07
  • python列表與列表算法詳解(2)

    python列表與列表算法詳解(2)

    這篇文章主要介紹了Python的列表和列表算法,小編感覺這篇文章具有一定參考價值,需要的朋友可以了解下,希望能給你帶來幫助
    2021-08-08
  • Python中安裝easy_install的方法

    Python中安裝easy_install的方法

    這篇文章主要介紹了Python中安裝easy_install的方法,需要的朋友可以參考下
    2018-11-11
  • 詳解python3中tkinter知識點

    詳解python3中tkinter知識點

    本篇文章給大家分享了關(guān)于python3中tkinter的相關(guān)知識點以及實例代碼,有興趣的朋友參考下。
    2018-06-06
  • PyTorch?Tensor創(chuàng)建實現(xiàn)

    PyTorch?Tensor創(chuàng)建實現(xiàn)

    本文主要介紹了PyTorch?Tensor創(chuàng)建實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-06-06
  • Python HTML解析模塊HTMLParser用法分析【爬蟲工具】

    Python HTML解析模塊HTMLParser用法分析【爬蟲工具】

    這篇文章主要介紹了Python HTML解析模塊HTMLParser用法,結(jié)合實例形式分析了HTMLParser模塊功能、常用函數(shù)及作為爬蟲工具相關(guān)使用技巧,需要的朋友可以參考下
    2019-04-04
  • python迭代器常見用法實例分析

    python迭代器常見用法實例分析

    這篇文章主要介紹了python迭代器常見用法,結(jié)合實例形式分析了Python迭代器概念、功能、常見操作方法及相關(guān)注意事項,需要的朋友可以參考下
    2019-11-11
  • 使用Python處理BAM的方法

    使用Python處理BAM的方法

    這篇文章主要介紹了使用Python處理BAM的方法,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下
    2018-09-09
  • Keras實現(xiàn)Vision?Transformer?VIT模型示例詳解

    Keras實現(xiàn)Vision?Transformer?VIT模型示例詳解

    這篇文章主要為大家介紹了Keras實現(xiàn)Vision?Transformer?VIT模型示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-05-05
  • Numpy之random函數(shù)使用學(xué)習(xí)

    Numpy之random函數(shù)使用學(xué)習(xí)

    這篇文章主要介紹了Numpy之random使用學(xué)習(xí),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-01-01

最新評論