Skip to content

Commit 2739270

Browse files
authored
fix(webauth): handle InvalidPassword error in _startSessionWithCredentials (#6)
1 parent cc8310a commit 2739270

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

steam/webauth.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
from getpass import getpass
6060
import requests
6161

62+
from steam.enums.common import EResult
6263
from steam.enums.proto import EAuthSessionGuardType, EAuthTokenPlatformType, ESessionPersistence
6364
from steam.steamid import SteamID
6465
from steam.utils.web import generate_session_id
@@ -208,10 +209,16 @@ def _startSessionWithCredentials(self, account_encrypted_password: str,
208209
'BeginAuthSessionViaCredentials',
209210
1
210211
)
211-
self.client_id = resp['response']['client_id']
212-
self.request_id = resp['response']['request_id']
213-
self.steam_id = SteamID(resp['response']['steamid'])
214-
self.allowed_confirmations = [EAuthSessionGuardType(confirm_type['confirmation_type']) for confirm_type in resp['response']['allowed_confirmations']]
212+
try:
213+
self.client_id = resp['response']['client_id']
214+
self.request_id = resp['response']['request_id']
215+
self.steam_id = SteamID(resp['response']['steamid'])
216+
self.allowed_confirmations = [EAuthSessionGuardType(confirm_type['confirmation_type']) for confirm_type in resp['response']['allowed_confirmations']]
217+
except KeyError as e:
218+
if resp.get('response', {}).get('interval') == EResult.InvalidPassword:
219+
raise LoginIncorrect(resp)
220+
else:
221+
raise WebAuthException(e, resp)
215222

216223
def _startLoginSession(self):
217224
"""Starts login session via credentials."""

0 commit comments

Comments
 (0)