Python implementation of the Golden Hill fast-disk check-in program _python

Source: Internet
Author: User

Copy Code code as follows:

__author__ = ' clownfish '
#coding: Utf-8
Import Urllib2,urllib,cookielib,json

Username = "Fast disk username"
Password = "Fast disk 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 "Open login page"
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 "Network link error"
Return False
Print "Login successful, ready to sign in!" "
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 "Congratulations on your sign-in success!" "
K = l[' Increase ']*1
m = l[' rewardsize '] * 1
if (k = = 0 and l[' monthtask '). M900 = = 900):
Print "Check in score for this month has been received complete"
Else
Print "check-in bonus points:%s"% (k)
if m = = 0:
Print "is a bad luck!" Reward 0M Space "
Else
Print "check-in Bonus space:%s"% (m)
Else
if (l[' state '] = = 102):
Print "You've signed in today."
Else
Print "Sign-in failed, encountered network error, please try again later!" "

Return sign


if __name__ = = "__main__":
Sign = sign (Username,password)
If Sign.login ():
Sign.sign ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.