added steam_abstraction.py for steam api functions
This commit is contained in:
parent
746fd9aa59
commit
87068c0422
|
@ -0,0 +1,41 @@
|
|||
from steam.client import SteamClient
|
||||
from getpass import getpass
|
||||
|
||||
client = SteamClient()
|
||||
|
||||
|
||||
@client.on('error')
|
||||
def error(result):
|
||||
return f"Logon result: {result}"
|
||||
|
||||
|
||||
def steamlogin(accname, passwd, twofa):
|
||||
try:
|
||||
client.login(accname, passwd, two_factor_code=twofa)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
def steamlogout():
|
||||
try:
|
||||
client.logout()
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
# dit is als je de py code alleen uitvoert. dus meer testen
|
||||
if __name__ == "__main__":
|
||||
username = input('Username: ')
|
||||
password = getpass('Password: ')
|
||||
twofactor = input('Twofactor: ')
|
||||
|
||||
steamlogin(username, password, twofactor)
|
||||
|
||||
print("Logged on as:", client.user.name)
|
||||
print("Community profile:", client.steam_id.community_url)
|
||||
print("Last logon:", client.user.last_logon)
|
||||
print("Last logoff:", client.user.last_logoff)
|
||||
|
||||
client.logout()
|
Reference in New Issue