steampy icon indicating copy to clipboard operation
steampy copied to clipboard

Issue Logging In

Open ExpiredMeteor6 opened this issue 1 year ago • 22 comments

Hi there, appologies if this issue is purely my idiocy, but i do not believe that this login is working...

image (details input are correct)

Traceback (most recent call last): File "c:\Users\Cam\Documents\GitHub\steam-bot-manager\steambot.py", line 16, in steam_client.login(USERNAME, PASSWORD, PATH_TO_STEAMGUARD_FILE) File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\client.py", line 110, in login LoginExecutor(self.username, self._password, self.steam_guard['shared_secret'], self._session).login() File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\login.py", line 38, in login self._update_steam_guard(login_response) File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\login.py", line 116, in _update_steam_guard client_id = login_response.json()['response']['client_id'] KeyError: 'client_id'

After printing out the login_response.json() i found this, which seems to be empty? {'response': {'interval': 5, 'extended_error_message': ''}}

Any help would be appreciated, Thanks

ExpiredMeteor6 avatar Feb 17 '24 15:02 ExpiredMeteor6

The login works, I just checked it and I get the response is_session_alive(). maybe there is an error somewhere in the .maFile or it is invalid

SiSiska avatar Feb 17 '24 17:02 SiSiska

hey, appreciate the response, ran again and it worked but is_session_alive() returned False Looking into it further now

ExpiredMeteor6 avatar Feb 17 '24 17:02 ExpiredMeteor6

I had one of the keys in uppercase in my .mafile and I caught the error. For a long time I couldn’t understand why, but it turned out to be simple.

SiSiska avatar Feb 17 '24 17:02 SiSiska

The login works, I just checked it and I get the response is_session_alive(). maybe there is an error somewhere in the .maFile or it is invalid

the PATH_TO_STEAMGUARD_FILE is a json file in the form { "steamid": "xx", "shared_secret": "xx", "identity_secret": "xxx" }

all details copied directly from SDA maFile

ExpiredMeteor6 avatar Feb 17 '24 17:02 ExpiredMeteor6

I had one of the keys in uppercase in my .mafile and I caught the error. For a long time I couldn’t understand why, but it turned out to be simple.

Ok, so login works and provides all necessary cookies, unfortunately is_session_alive() still returns False :(

ExpiredMeteor6 avatar Feb 17 '24 17:02 ExpiredMeteor6

https://github.com/bukson/steampy/issues/343 did you make changes to the code from this issue?

SiSiska avatar Feb 17 '24 17:02 SiSiska

Hi there, appologies if this issue is purely my idiocy, but i do not believe that this login is working...

image (details input are correct)

Traceback (most recent call last): File "c:\Users\Cam\Documents\GitHub\steam-bot-manager\steambot.py", line 16, in steam_client.login(USERNAME, PASSWORD, PATH_TO_STEAMGUARD_FILE) File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\client.py", line 110, in login LoginExecutor(self.username, self._password, self.steam_guard['shared_secret'], self._session).login() File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\login.py", line 38, in login self._update_steam_guard(login_response) File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\login.py", line 116, in _update_steam_guard client_id = login_response.json()['response']['client_id'] KeyError: 'client_id'

After printing out the login_response.json() i found this, which seems to be empty? {'response': {'interval': 5, 'extended_error_message': ''}}

Any help would be appreciated, Thanks

same error occurs if u have exceeded request limit

Hodackin avatar Feb 17 '24 17:02 Hodackin

#343 did you make changes to the code from this issue?

I have not no, just looked at it, bit confused what all needs changing so i dont go break it all! Thanks again :D

ExpiredMeteor6 avatar Feb 17 '24 17:02 ExpiredMeteor6

Hi there, appologies if this issue is purely my idiocy, but i do not believe that this login is working... image (details input are correct) Traceback (most recent call last): File "c:\Users\Cam\Documents\GitHub\steam-bot-manager\steambot.py", line 16, in steam_client.login(USERNAME, PASSWORD, PATH_TO_STEAMGUARD_FILE) File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\client.py", line 110, in login LoginExecutor(self.username, self._password, self.steam_guard['shared_secret'], self._session).login() File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\login.py", line 38, in login self._update_steam_guard(login_response) File "C:\Users\Cam\AppData\Local\Programs\Python\Python310\lib\site-packages\steampy\login.py", line 116, in _update_steam_guard client_id = login_response.json()['response']['client_id'] KeyError: 'client_id' After printing out the login_response.json() i found this, which seems to be empty? {'response': {'interval': 5, 'extended_error_message': ''}} Any help would be appreciated, Thanks

same error occurs if u have exceeded request limit

Thanks :D

ExpiredMeteor6 avatar Feb 17 '24 17:02 ExpiredMeteor6

from steampy.client import SteamClient
# from steampy.models import GameOptions, Asset
from steampy import guard
# import Save_and_Load
import pickle
import glob
import os
import json


class Login:
    api = "0000000000000000"
    PATH_TO_STEAMGUARD_FILE = glob.glob("*.maFile")[0]
    maFile = guard.load_steam_guard(PATH_TO_STEAMGUARD_FILE)
    steam_id = maFile["Session"]["SteamID"]
    MY_USERNAME = maFile["account_name"]
    MY_PASSWORD = "password"

    def __init__(self):
        self.sc_session = "steam_client_session"
        self.steam_client = None

    def trade(self):
        self.authorization()
        print(self.steam_client.is_session_alive())
        exit()
        # othercode

    def сreate_steam_session(self):
        print("You not authorized, trying to login into Steam\nSigning in steam account")
        self.steam_client = SteamClient(api_key=Login.api)
        self.steam_client.session.cookies.set("steamRememberLogin", 'true')
        self.steam_client.login(Login.MY_USERNAME, Login.MY_PASSWORD, Login.PATH_TO_STEAMGUARD_FILE)
        print('Saving session')
        with open(f'{self.sc_session}', 'wb') as f:
            pickle.dump(self.steam_client, f)

    def authorization(self):
        if os.path.isfile(f"{self.sc_session}"):
            print('Using previous session')
            with open(f'{self.sc_session}', 'rb') as f:
                self.steam_client = pickle.load(f)

            session_alive = self.steam_client.is_session_alive()
            if not session_alive:
                print(f'Session dead {session_alive}')
                os.remove(f"{self.sc_session}")
                print(f'Create new session {session_alive}')
                self.сreate_steam_session()
        else:
            self.сreate_steam_session()


if __name__ == "__main__":
    login = Login()
    login.trade()
    pass

this my code ;)) I was surfing around here somewhere and found this option with saving the session. Helps protect against Steam blocking.

SiSiska avatar Feb 17 '24 17:02 SiSiska

from steampy.client import SteamClient
# from steampy.models import GameOptions, Asset
from steampy import guard
# import Save_and_Load
import pickle
import glob
import os
import json


class Login:
    api = "0000000000000000"
    PATH_TO_STEAMGUARD_FILE = glob.glob("*.maFile")[0]
    maFile = guard.load_steam_guard(PATH_TO_STEAMGUARD_FILE)
    steam_id = maFile["Session"]["SteamID"]
    MY_USERNAME = maFile["account_name"]
    MY_PASSWORD = "password"

    def __init__(self):
        self.sc_session = "steam_client_session"
        self.steam_client = None

    def trade(self):
        self.authorization()
        print(self.steam_client.is_session_alive())
        exit()
        # othercode

    def сreate_steam_session(self):
        print("You not authorized, trying to login into Steam\nSigning in steam account")
        self.steam_client = SteamClient(api_key=Login.api)
        self.steam_client.session.cookies.set("steamRememberLogin", 'true')
        self.steam_client.login(Login.MY_USERNAME, Login.MY_PASSWORD, Login.PATH_TO_STEAMGUARD_FILE)
        print('Saving session')
        with open(f'{self.sc_session}', 'wb') as f:
            pickle.dump(self.steam_client, f)

    def authorization(self):
        if os.path.isfile(f"{self.sc_session}"):
            print('Using previous session')
            with open(f'{self.sc_session}', 'rb') as f:
                self.steam_client = pickle.load(f)

            session_alive = self.steam_client.is_session_alive()
            if not session_alive:
                print(f'Session dead {session_alive}')
                os.remove(f"{self.sc_session}")
                print(f'Create new session {session_alive}')
                self.сreate_steam_session()
        else:
            self.сreate_steam_session()


if __name__ == "__main__":
    login = Login()
    login.trade()
    pass

this my code ;)) I was surfing around here somewhere and found this option with saving the session. Helps protect against Steam blocking.

ooo ideal, i have around 100 accounts to control, part of a skin withdrawal system im working on

ExpiredMeteor6 avatar Feb 17 '24 17:02 ExpiredMeteor6

If you can solve the problem with make_offer, please let me know.

SiSiska avatar Feb 17 '24 17:02 SiSiska

will do :)

ExpiredMeteor6 avatar Feb 17 '24 17:02 ExpiredMeteor6

from steampy.client import SteamClient
# from steampy.models import GameOptions, Asset
from steampy import guard
# import Save_and_Load
import pickle
import glob
import os
import json


class Login:
    api = "0000000000000000"
    PATH_TO_STEAMGUARD_FILE = glob.glob("*.maFile")[0]
    maFile = guard.load_steam_guard(PATH_TO_STEAMGUARD_FILE)
    steam_id = maFile["Session"]["SteamID"]
    MY_USERNAME = maFile["account_name"]
    MY_PASSWORD = "password"

    def __init__(self):
        self.sc_session = "steam_client_session"
        self.steam_client = None

    def trade(self):
        self.authorization()
        print(self.steam_client.is_session_alive())
        exit()
        # othercode

    def сreate_steam_session(self):
        print("You not authorized, trying to login into Steam\nSigning in steam account")
        self.steam_client = SteamClient(api_key=Login.api)
        self.steam_client.session.cookies.set("steamRememberLogin", 'true')
        self.steam_client.login(Login.MY_USERNAME, Login.MY_PASSWORD, Login.PATH_TO_STEAMGUARD_FILE)
        print('Saving session')
        with open(f'{self.sc_session}', 'wb') as f:
            pickle.dump(self.steam_client, f)

    def authorization(self):
        if os.path.isfile(f"{self.sc_session}"):
            print('Using previous session')
            with open(f'{self.sc_session}', 'rb') as f:
                self.steam_client = pickle.load(f)

            session_alive = self.steam_client.is_session_alive()
            if not session_alive:
                print(f'Session dead {session_alive}')
                os.remove(f"{self.sc_session}")
                print(f'Create new session {session_alive}')
                self.сreate_steam_session()
        else:
            self.сreate_steam_session()


if __name__ == "__main__":
    login = Login()
    login.trade()
    pass

this my code ;)) I was surfing around here somewhere and found this option with saving the session. Helps protect against Steam blocking.

from adapting and implementing your code, i get this Using previous session Session dead False Create new session False You not authorized, trying to login into Steam Signing in steam account Saving session False still seems like the session is not alive? was there anything specific i needed to change within the package?

ExpiredMeteor6 avatar Feb 17 '24 17:02 ExpiredMeteor6

https://github.com/bukson/steampy/issues/343

SiSiska avatar Feb 17 '24 18:02 SiSiska

After these changes, the session should come to life, but Steam will not accept it. Unfortunately. And I don’t know how to solve this and no one knows. And even if he knows, he doesn’t give an answer.

SiSiska avatar Feb 17 '24 18:02 SiSiska

Unfortunately

ok, thanks again, will look into it further and see what i can find

ExpiredMeteor6 avatar Feb 17 '24 18:02 ExpiredMeteor6

client.py

    def _get_session_id(self) -> str:
        return self._session.cookies.get_dict("steamcommunity.com")['sessionid']

SiSiska avatar Feb 17 '24 18:02 SiSiska

repair after change 343 need chenge all self._get_session id() self._session.cookies.get_dict("steamcommunity.com")['sessionid']

pycharm64_OPblKPM9J1

In general, there was this solution, but something didn’t work out for the person and I thought that this was not a working part of the code, but I decided to recheck all the modules, and it turned out that this needed to be changed in more than one place client.py and market.py.

oo so should trade offers work too? Thanks :D

ExpiredMeteor6 avatar Feb 17 '24 18:02 ExpiredMeteor6

client.py

    def _get_session_id(self) -> str:
        return self._session.cookies.get_dict("steamcommunity.com")['sessionid']

SiSiska avatar Feb 17 '24 18:02 SiSiska

def _get_session_id(self) -> str: return self._session.cookies.get_dict("steamcommunity.com")['sessionid']

i can accept offers, get balance, inventory etc but i cant send and offer... i get this response

{'strError': 'There was an error sending your trade offer. Please try again later. (26)'} after printing the status code: 500 - seems to be a standard use error code

def send_tradeable_skins_to_main(self) -> bool:
        '''Send all non-trade locked skins to main account'''
        items = [Asset(asset_id="35826503428", game=GameOptions.CS, amount=1)]
        print(self.steam_client.make_offer_with_url(trade_offer_url=self.main_trade_url, message="test", items_from_them=items, items_from_me=[]))
        pass

ExpiredMeteor6 avatar Feb 17 '24 20:02 ExpiredMeteor6

def _get_session_id(self) -> str: return self._session.cookies.get_dict("steamcommunity.com")['sessionid']

i can accept offers, get balance, inventory etc but i cant send and offer... i get this response

{'strError': 'There was an error sending your trade offer. Please try again later. (26)'} after printing the status code: 500 - seems to be a standard use error code

def send_tradeable_skins_to_main(self) -> bool:
        '''Send all non-trade locked skins to main account'''
        items = [Asset(asset_id="35826503428", game=GameOptions.CS, amount=1)]
        print(self.steam_client.make_offer_with_url(trade_offer_url=self.main_trade_url, message="test", items_from_them=items, items_from_me=[]))
        pass

I AM AN IDIOT, i was trying to send trade locked items haha, works :D

ExpiredMeteor6 avatar Feb 17 '24 20:02 ExpiredMeteor6