-
Notifications
You must be signed in to change notification settings - Fork 26
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
Added isSessionExpired() method #31. #32
Conversation
@dnl-blkv all yours 👀 |
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.
A few comments
# Endpoints not requiring active session for the request to succeed. | ||
_URL_DEVICE_SERVER = 'device-server' | ||
_URI_INSTALLATION = 'installation' | ||
_URI_SESSION_SERVER = 'session-server' |
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.
Please put these constants after the map (just like we do in PHP).
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.
That won't work in python 😅 ?
https://stackoverflow.com/questions/1590608/is-it-possible-to-forward-declare-a-function-in-python
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.
Ahh, you're right! My apologies.
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.
python is not that magical ✨ 😂
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.
@OGKevin declare time mixed with run time? Tell me it is not magical :P
@@ -93,7 +103,8 @@ def _request(self, method, uri_relative, request_bytes, params, | |||
|
|||
uri_relative_with_params = self._append_params_to_uri(uri_relative, | |||
params) | |||
self._api_context.ensure_session_active() | |||
if uri_relative not in self._URIS_NOT_REQUIRING_ACTIVE_SESSION: | |||
self._api_context.ensure_session_active() |
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.
Please add a newline after the if body! :)
bunq/sdk/context.py
Outdated
|
||
def is_session_active(self): | ||
""" | ||
:return: True if it has expired, otherwise false |
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.
Please kill this return
part: the method is quite obvious!
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.
Looks good!
Context
#31
What has been done
This pr introduces a new way to handle
SessionContext
. Now it is possible to do the following:This way there is no saving an unchanged context.
Closes #31