steampy icon indicating copy to clipboard operation
steampy copied to clipboard

Long Lasting Session

Open SamuelKollar opened this issue 1 year ago • 4 comments

Can someone, who has a session that lasts longer than a week, share their code and briefly explain how it works? I am having trouble having the session last longer than a week, sometimes I get rate limited from Steam and am not sure how to properly maintain the session, I need it to be alive 24/7.

SamuelKollar avatar Jan 10 '24 20:01 SamuelKollar

To keep your session always up to date, you can use the is_session_alive() method to find out if the session is alive, if it is dead, then create it again. My sessions don’t last more than a day, they used to last a month, but after the update in the summer of 2023, the sessions stopped living for a long time

Dandelion101 avatar Jan 12 '24 10:01 Dandelion101

Yeah, I tried using is_session_alive() but the issue I have with it is that if I call it every 0.5s or so after like an hour I start getting no reply from Steam (probably a rate limit or something).

SamuelKollar avatar Jan 12 '24 12:01 SamuelKollar

Yeah, I tried using is_session_alive() but the issue I have with it is that if I call it every 0.5s or so after like an hour I start getting no reply from Steam (probably a rate limit or something).

The official Steam documentation states that no more than 20 requests per minute are allowed.

You don't need to use this method that often, for example you can only use it when errors appear indicating that the session is no longer working if (response_sell_order["message"] == ('There was a problem listing your item. Refresh the page ' 'and try again.') and not self.steam_client.is_session_alive()): self.create_steam_session()

Dandelion101 avatar Jan 14 '24 11:01 Dandelion101

Yeah, I have made it so that .is_session_alive() is called once every 10s or so and so far it seems to work

SamuelKollar avatar Jan 14 '24 13:01 SamuelKollar