|
|
@ -79,6 +79,7 @@ class WebAuth(object): |
|
|
|
session = None #: :class:`requests.Session` (with auth cookies after auth is complete) |
|
|
|
captcha_gid = -1 |
|
|
|
steam_id = None #: :class:`.SteamID` (after auth is complete) |
|
|
|
_session_id = None |
|
|
|
|
|
|
|
def __init__(self, username, password): |
|
|
|
self.__dict__.update(locals()) |
|
|
@ -118,6 +119,23 @@ class WebAuth(object): |
|
|
|
|
|
|
|
return resp |
|
|
|
|
|
|
|
@property |
|
|
|
def session_id(self): |
|
|
|
if self._session_id: |
|
|
|
return self._session_id |
|
|
|
try: |
|
|
|
headers = { |
|
|
|
'X-Requested-With': 'com.valvesoftware.android.steam.community'} |
|
|
|
self.session.get('https://steamcommunity.com/login', |
|
|
|
params={'oauth_client_id': 'DE45CD61', |
|
|
|
'oauth_scope': 'read_profile write_profile read_client write_client' |
|
|
|
}, |
|
|
|
headers=headers, timeout=15) |
|
|
|
except requests.exceptions.RequestException as e: |
|
|
|
raise HTTPError(str(e)) |
|
|
|
self._session_id = self.session.cookies['sessionid'] |
|
|
|
return self._session_id |
|
|
|
|
|
|
|
def _load_key(self): |
|
|
|
if not self.key: |
|
|
|
resp = self.get_rsa_key(self.username) |
|
|
@ -251,17 +269,22 @@ class MobileWebAuth(WebAuth): |
|
|
|
class WebAuthException(Exception): |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
class HTTPError(WebAuthException): |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
class LoginIncorrect(WebAuthException): |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
class CaptchaRequired(WebAuthException): |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
class EmailCodeRequired(WebAuthException): |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
class TwoFactorCodeRequired(WebAuthException): |
|
|
|
pass |
|
|
|