Esempio n. 1
0
def _login_from_session(steamid):
    print("Logging {0} from session file".format(
        db.get_account_username_by_steamid(steamid)))
    account = db.get_all_creds_by_steamid(steamid)
    path = os.path.join(USER_DATA_FOLDER, steamid + ".session")
    if not os.path.exists(path):
        return None
    sg_path = os.path.join(USER_DATA_FOLDER, steamid + ".json")
    session = requests.session()
    with open(path, 'rb') as f:
        session.cookies.update(pickle.load(f))
    client = SteamClient(account['steamapikey'], account['username'],
                         account['password'], sg_path)
    client._session = session
    client.was_login_executed = True
    if client.is_session_alive():
        print("LOGGED FROM SESSION")
        return client
Esempio n. 2
0
 def test_logout(self):
     client = SteamClient(self.credentials.api_key)
     client.login(self.credentials.login, self.credentials.password,
                  self.steam_guard_file)
     self.assertTrue(client.is_session_alive())
     client.logout()