steampy icon indicating copy to clipboard operation
steampy copied to clipboard

Get a cookie for future use

Open luckyway7 opened this issue 1 year ago • 1 comments

from steampy.client import SteamClient

login_cookies = {} # provide dict with cookies
steam_client = SteamClient('MY_API_KEY',username='MY_USERNAME',login_cookies=login_cookies)
assert steam_client.was_login_executed

Steampy has a method for logging in using cookies. My question is how can I get these cookies if I am logged in using my username and password?

luckyway7 avatar Apr 03 '24 09:04 luckyway7

The ‍‍‍SteamClient class has a private property named _session, which is an instance of requests.Session(). Although _session is private and direct usage is discouraged, you can still utilize method _session.cookies.get_dict() for this purpose.

sd702004 avatar Apr 03 '24 15:04 sd702004