Python實現(xiàn)的金山快盤的簽到程序
__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)文章
PyTorch?Tensor創(chuàng)建實現(xiàn)
本文主要介紹了PyTorch?Tensor創(chuàng)建實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-06-06Python HTML解析模塊HTMLParser用法分析【爬蟲工具】
這篇文章主要介紹了Python HTML解析模塊HTMLParser用法,結(jié)合實例形式分析了HTMLParser模塊功能、常用函數(shù)及作為爬蟲工具相關(guān)使用技巧,需要的朋友可以參考下2019-04-04Keras實現(xiàn)Vision?Transformer?VIT模型示例詳解
這篇文章主要為大家介紹了Keras實現(xiàn)Vision?Transformer?VIT模型示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-05-05Numpy之random函數(shù)使用學(xué)習(xí)
這篇文章主要介紹了Numpy之random使用學(xué)習(xí),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-01-01