Skip to content

Commit

Permalink
Fix set_login_cookies (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
Deihim007 authored and bukson committed Nov 16, 2023
1 parent ac15eb8 commit c7f19a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ User can also provide login_cookies from browser to log in by cookies.
from steampy.client import SteamClient

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

Expand Down Expand Up @@ -148,7 +148,7 @@ Set login cookies, can be used instead of normal `login` method.
from steampy.client import SteamClient

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

Expand Down
2 changes: 1 addition & 1 deletion steampy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def set_login_cookies(self, cookies: dict) -> None:
self.was_login_executed = True

if self.steam_guard is None:
self.steam_guard = {'steam_id': self.get_steam_id()}
self.steam_guard = {'steamid': str(self.get_steam_id())}

self.market._set_login_executed(self.steam_guard, self._get_session_id())

Expand Down

1 comment on commit c7f19a5

@alwaysneedhelp
Copy link

@alwaysneedhelp alwaysneedhelp commented on c7f19a5 Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why doesn't this method work?

I try to login by cookies :

from steampy.client import SteamClient
import requests
from body_tg_buyer import *
from bs4 import BeautifulSoup




user = set_cookies('cookies.json')


resp = user.get('https://steamcommunity.com/dev/apikey')
soup = BeautifulSoup(resp.text, 'lxml')
body = soup.find('div', attrs = {'id' : 'bodyContents_ex'}).find('p').text
apikey = [a for a in body.split(' ') if len(a) == 32][0]
print(apikey)


cookies = get_cookies('cookies.json')[0] # provide dict with cookies
print(cookies)
steam_client = SteamClient(apikey, username='MY_USERNAME', login_cookies = cookies)
print(steam_client.was_login_executed)

but its still giving me error :
TypeError: SteamClient.__init__() got an unexpected keyword argument 'login_cookies'

Please sign in to comment.