-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New auth pattern #303
New auth pattern #303
Conversation
patch by nbordin
I will test it and review today, thanks! |
@staticmethod | ||
def _create_cookie(name: str, cookie: str, domain: str) -> dict: | ||
return {"name": name, | ||
"value": cookie, | ||
"domain": domain} | ||
|
||
def _fetch_rsa_params(self, current_number_of_repetitions: int = 0) -> dict: | ||
self.session.post(SteamUrl.COMMUNITY_URL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this post, it seems to be doing nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required for the initialization of the session with which we will work.
steampy/login.py
Outdated
self.session.cookies.set(**community_cookie) | ||
self.session.cookies.set(**store_cookie) | ||
|
||
@staticmethod | ||
def _create_cookie(name: str, cookie: str, domain: str) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move that to utils please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
steampy/login.py
Outdated
|
||
def _fetch_home_page(self, session: Session) -> Response: | ||
return session.post(SteamUrl.COMMUNITY_URL + '/my/home/') | ||
|
||
def _update_steam_guard(self, login_response: Response) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should return None as it just changes internal state, and we never use its value if it is ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
steampy/login.py
Outdated
else: | ||
raise Exception('Cannot update steam guard') | ||
|
||
def _pool_sessions_steam(self, client_id, request_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add types please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
steampy/login.py
Outdated
response = self._api_call('POST', 'IAuthenticationService', 'PollAuthSessionStatus', params = pool_data) | ||
self.refresh_token = response.json()["response"]["refresh_token"] | ||
|
||
def _finallize_login(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add return type and fix typo, should be _finalize_login
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
steampy/login.py
Outdated
sessionid = self.session.cookies["sessionid"] | ||
redir = "https://steamcommunity.com/login/home/?goto=" | ||
|
||
finallez_data = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
steampy/login.py
Outdated
|
||
def _finallize_login(self): | ||
sessionid = self.session.cookies["sessionid"] | ||
redir = "https://steamcommunity.com/login/home/?goto=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change variable name to be more descriptive and use COMMUNITY_URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Please resolve the comments Also if you can research the logout method, I was able to pass login test, but logout was unsucesfull. I can merge this without logout working but it will be probably next complain. |
patch by nbordin fixed
I've never used the Logout function all these years. P.S. Taking this opportunity, I'd like to thank you for this wonderful project! |
Tested login and inventory.