1
Fork 0

added steam_abstraction.py for steam api functions

This commit is contained in:
Ventilaar 2021-01-11 14:34:45 +01:00
parent 746fd9aa59
commit 87068c0422
1 changed files with 41 additions and 0 deletions

41
steam_abstraction.py Normal file
View File

@ -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()