Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SteamLogin, SteamMobileAuth, pickle, SteamTradeOffers, SteamWebApi
- def Login():
- print "Please log in to use this feature."
- print "Username:"
- username = raw_input()
- print "Password:"
- password = raw_input()
- details = {
- "username":username,
- "password":password,
- # "shared_secret":"secret",
- }
- try:
- with open("Login.pickle") as f:
- print "Loading existing session."
- Login = pickle.load(f)
- assert isinstance(Login, SteamLogin.SteamLogin), "Fuque."
- Login.custom_url = Login._getCustomURL()
- Login.steamID = Login._getSteamID()
- print "OK."
- except IOError:
- # if True:
- Login = SteamLogin.SteamLogin()
- offset = SteamMobileAuth.getTimeOffset()
- while True:
- try:
- Login.login(details)
- break
- except SteamLogin.TwoFactorCodeRequiredException:
- print("Enter your 2FA code.")
- details['twoFactorCode'] = raw_input()
- #details['twoFactorCode'] = SteamMobileAuth.generateAuthCode(details['shared_secret'],offset)
- except SteamLogin.CaptchaRequiredException as e:
- print e
- details['captcha'] = raw_input()
- except SteamLogin.EmailAuthException as e:
- print(e)
- except SteamLogin.TooManyRequestsException as e:
- print "Retrying after " + e.retryafter+5 + " seconds"
- time.sleep(e.retryafter+5)
- with open("Login.pickle",'wb') as f:
- print "Saving session to Login.picke"
- # pass #temporary until it works
- pickle.dump(Login,f)
- return Login
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement