Python3模拟金山快盘打卡

# zhouxianglh 2013.05.09 python3.3
# Python 模拟登录,然后记录cookie,打卡签到
import urllib.request
import http.cookiejar
import json
import sys

# 登录金山快盘
params = {"username":"用户名", "userpwd":"密码", "isajax":"yes", }
webCookie = http.cookiejar.CookieJar()
openner = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(webCookie))
# 登录首页获取相关cookie用于登录
webRequest = openner.open("https://www.kuaipan.cn/account_login.htm")  
# 登录快盘
webRequest = openner.open("https://www.kuaipan.cn/index.php?ac=account&op=login", urllib.parse.urlencode(params).encode())  
# 网页是用utf-8编码,所以这里用utf-8编码
htmlData = webRequest.read().decode('utf-8')  
# 解析json信息
result = json.loads(htmlData) 
print("登录信息:", result["errcode"])


if result["state"] == "1" :
    print("登录成功,开始的卡")
    webRequest = openner.open("http://www.kuaipan.cn/index.php?ac=common&op=usersign") 
    htmlData = webRequest.read().decode('utf-8')
    result = json.loads(htmlData)
    if result["state"] == -102:  
        print("今天已签到过")
    elif result["state"] == 1:
        print("签到成功,赠送积分 %s,当前积分 %s,签到送空间 %sMB" % (result["increase"], result["status"]["points"], result["rewardsize"]))
else :
    print("登录失败")       
    sys.exit() 
        
# 显示当肖快盘信息
webRequest = openner.open("http://www.kuaipan.cn/index.php?ac=home&op=space") 
htmlData = webRequest.read().decode('utf-8')
result = json.loads(htmlData)
transform = 1024 * 1024 * 1024  # 以Byte为单位,所以这里要转换
print("当前空间:%.2f GB,已使用:%.2f GB" % (int(result["xLive"]["total"]) / transform, int(result["xLive"]["used"]) / transform))
 

 用金山快盘,用于文本备份同步,大概用两年多了,用得蛮好,只是每天要打卡扩容蛮烦的.以下是邀请链接,有兴趣的可以试试.

http://www.kuaipan.cn/?channel=bky5t3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值