bukson / steampy

A Steam trading library for python 3
MIT License
577 stars 157 forks source link

Get a cookie for future use #381

Open luckyway7 opened 7 months ago

luckyway7 commented 7 months ago
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?

sd702004 commented 7 months ago

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.