Skip to content

Commit

Permalink
fix(webauth): handle InvalidPassword error in _startSessionWithCreden…
Browse files Browse the repository at this point in the history
…tials (#6)
  • Loading branch information
detiam authored Nov 7, 2024
1 parent cc8310a commit 2739270
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions steam/webauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from getpass import getpass
import requests

from steam.enums.common import EResult
from steam.enums.proto import EAuthSessionGuardType, EAuthTokenPlatformType, ESessionPersistence
from steam.steamid import SteamID
from steam.utils.web import generate_session_id
Expand Down Expand Up @@ -208,10 +209,16 @@ def _startSessionWithCredentials(self, account_encrypted_password: str,
'BeginAuthSessionViaCredentials',
1
)
self.client_id = resp['response']['client_id']
self.request_id = resp['response']['request_id']
self.steam_id = SteamID(resp['response']['steamid'])
self.allowed_confirmations = [EAuthSessionGuardType(confirm_type['confirmation_type']) for confirm_type in resp['response']['allowed_confirmations']]
try:
self.client_id = resp['response']['client_id']
self.request_id = resp['response']['request_id']
self.steam_id = SteamID(resp['response']['steamid'])
self.allowed_confirmations = [EAuthSessionGuardType(confirm_type['confirmation_type']) for confirm_type in resp['response']['allowed_confirmations']]
except KeyError as e:
if resp.get('response', {}).get('interval') == EResult.InvalidPassword:
raise LoginIncorrect(resp)
else:
raise WebAuthException(e, resp)

def _startLoginSession(self):
"""Starts login session via credentials."""
Expand Down

0 comments on commit 2739270

Please sign in to comment.