Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Logging In #367

Open
ExpiredMeteor6 opened this issue Feb 17, 2024 · 22 comments
Open

Issue Logging In #367

ExpiredMeteor6 opened this issue Feb 17, 2024 · 22 comments

Comments

@ExpiredMeteor6
Copy link

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

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

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

@ExpiredMeteor6
Copy link
Author

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

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

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.

@ExpiredMeteor6
Copy link
Author

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
Copy link
Author

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 :(

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

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

@Hodackin
Copy link

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

@ExpiredMeteor6
Copy link
Author

#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
Copy link
Author

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

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

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.

@ExpiredMeteor6
Copy link
Author

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

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

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

@ExpiredMeteor6
Copy link
Author

will do :)

@ExpiredMeteor6
Copy link
Author

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?

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

#343

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

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.

@ExpiredMeteor6
Copy link
Author

Unfortunately

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

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

client.py

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

@ExpiredMeteor6
Copy link
Author

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

@SiSiska
Copy link

SiSiska commented Feb 17, 2024

client.py

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

@ExpiredMeteor6
Copy link
Author

ExpiredMeteor6 commented Feb 17, 2024

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants