Browse Source

Add oauth_login docstring, don't hide unhandled error details

pull/211/head
melvyn2 5 years ago
parent
commit
3547d244fe
No known key found for this signature in database GPG Key ID: 25A2B7280CE3AFF6
  1. 16
      steam/webauth.py

16
steam/webauth.py

@ -323,6 +323,20 @@ class MobileWebAuth(WebAuth):
self.oauth_token = data['oauth_token'] self.oauth_token = data['oauth_token']
def oauth_login(self, oauth_token='', steam_id='', language='english'): def oauth_login(self, oauth_token='', steam_id='', language='english'):
"""Attempts a mobile authenticator login using an oauth token, which can be obtained from a previously logged-in
`MobileWebAuth`
:param oauth_token: The oauth token string
:type oauth_token: :class:`str`
:param steam_id: The `SteamID` of the account to log into
:type steam_id: :class:`str` or :class:`SteamID`
:param language: The language in which to start the session
:type language: :class:`str`
:return: a session on success and :class:`None` otherwise
:rtype: :class:`requests.Session`, :class:`None`
:raises HTTPError: any problem with http request, timeouts, 5xx, 4xx etc
:raises LoginIncorrect: Invalid token or SteamID
"""
if oauth_token: if oauth_token:
self.oauth_token = oauth_token self.oauth_token = oauth_token
else: else:
@ -354,7 +368,7 @@ class MobileWebAuth(WebAuth):
if 'Please verify your <pre>key=</pre> parameter.' in resp.text: if 'Please verify your <pre>key=</pre> parameter.' in resp.text:
raise LoginIncorrect('invalid token') raise LoginIncorrect('invalid token')
else: else:
raise WebAuthException('failed to decode response') raise e
self.session_id = generate_session_id() self.session_id = generate_session_id()

Loading…
Cancel
Save