Relogin problem...
I have 24/7 bot with your greate lib. From time to time session die and iht's bot can't send/accept trades. If bot relogin in cycle, login failed. When i off program and run again login true, how to relogin without stopping program?
I don't know, really.
Question, I'm going to assume the answer is no, but if you combined this with another steam python library, like the steam lib, and log on through there, would you need to log in with steampy?
yes, bcs there is another class
nobody don't know about this?
I am not sure how many people use my lib, but i don't think it is a lot
I meet this problem too, could anyone help me out?
If you just recreate the SteamClient object is it fine? I mean, instead of stopping the program when the problems starts, try to reinitialize the client: client=SteamClient(...)
Maybe browser send something like keep-alive request every k minutes and session is allive. Will be nice if somebody measure the time of logging out
@Ermans I tried reinit client, but still failed, while looking into the response from steam server, when the second time login sent, the verify code (generated by shared key and timestamp) is wrong, the server's response is same as the situation while submit wrong code in browser. But I cant find out the where is wrong.
@iseekwonderful Some time before the "session die", there are some activities (aka requests to steam server using your session) or there is a long time without requests? Just to be sure it isn't caused by inactivity
I, personally, have never had that problem before, what are you running it on?
I have the same problem. I have simple script to accept all gifts and after some time of inactivity (no incoming offers) or when I log into this account from other pc (it's my main) session dies and script crashes. I've created small shell script to restart it every time it happens.
#!/bin/bash until python3 AcceptAllGifts.py; do echo "Script crashed. Respawning in 10 seconds..." >&2 sleep 10 done
It is decent workaround but still I would love to know why sometimes InvalidCredentials is raised even though login credentials are valid. As far as I understand this issue problem is caused by steam and their response to instant reloging but I'm just a neewbie in this matter ;)
Problem is solved, it was due to initialization of default argument, once initialized in never changes default value, now it is ok
sorry for reopening old issue but I'm facing same problem, refresh_session() gets new sessionid but i still get same error everywhere else, it just returns null, which requires relogin
okay i found something weird, is_session_alive() returns false on every bot at same time, because they were logged in at same time but, i copied one of bots cookies over to browser, browser's session is still alive
Yes, i'm interested in that case too. Maybe just do a process which every ~12 hrs do relogin? Or change 'remember_login': 'false' to true? That will keep a valid web session for weeks (that i found in that lib https://github.com/OmG3r/steam-trade) remember_login give a long-live session. And solution is: relogin every week, with 'remember_login': 'true'.
Yes, i'm interested in that case too. Maybe just do a process which every ~12 hrs do relogin? Or change 'remember_login': 'false' to true? That will keep a valid web session for weeks (that i found in that lib https://github.com/OmG3r/steam-trade) remember_login give a long-live session. And solution is: relogin every week, with 'remember_login': 'true'.
i've changed remember login to true in my fork, and cookies stay alive, if i make requests.post request with same cookies it goes through, and if i inject cookies inside browser it also works, i have no clue what's causing session.post not to work (returns null), isn't cookies only thing session is saving?
Yes, i'm interested in that case too. Maybe just do a process which every ~12 hrs do relogin? Or change 'remember_login': 'false' to true? That will keep a valid web session for weeks (that i found in that lib https://github.com/OmG3r/steam-trade) remember_login give a long-live session. And solution is: relogin every week, with 'remember_login': 'true'.
i've changed remember login to true in my fork, and cookies stay alive, if i make requests.post request with same cookies it goes through, and if i inject cookies inside browser it also works, i have no clue what's causing session.post not to work (returns null), isn't cookies only thing session is saving?
It's depending on what do u post requests. Maybe just u do wrong request? And because of this it's return null? try the following code: bot._session.post('https://steamcommunity.com/tradeoffer/'+tradeofferid+'/cancel', data={'sessionid': bot._get_session_id()}) and just change url and bot variable to yours.
Guys if you fix something make a pull request I will gladly merge it.
I can't reproduce my own issue on my local machine, I'm starting to think that i messed up on server (with proxy or something that causes request to return null), @astroaut can you describe your problem? it returns null?
@Phalelashvili My issue is a short web-session on no relogin system. I have never get null from session, but i have got that response when i'm hit maximum requests to steam API.
@Phalelashvili My issue is a short web-session on no relogin system. I have never get null from session, but i have got that response when i'm hit maximum requests to steam API.
looks like we're having two different issues, i get null on specific accounts even tho session is alive, i'm also using proxy so it's not api limit changing remember login to true fixes short session (i guess) steampy/login.py line 80, just change it to true
small update: for some reason session is not sending steamRememberLogin cookie when making request which seems to be problem, but it's in cookieJar
client._session.get(url).request.headers
{'User-Agent': 'python-requests/2.19.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'browserid=12345; sessionid=superSecretSessionID; steamCountry=DE%7C0ec73fd8823a9da7c00a142962e1e413; steamLoginSecure=123ABC; steamMachineAuth00000000000000000=123ABC'}
requests.get(url, cookies=client.cookies.get_dict()).request.headers
{'User-Agent': 'python-requests/2.19.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'browserid=12345; sessionid=superSecretSessionID; steamCountry=DE%7C0ec73fd8823a9da7c00a142962e1e413; steamLoginSecure=123ABC; steamMachineAuth00000000000000000=123ABC; steamRememberLogin=00000000000000000ABCDE123'}