-
Notifications
You must be signed in to change notification settings - Fork 205
Allowing transport layer to be customized #169
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
Conversation
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.
Thanks for keep working on this PR!
I've not yet review the entire PR (especially not yet review the application.py), the following would be enough for our walk-through discussion to discuss.
2 high level topics are:
- Whether we would need a DefaultHttpClient in our code path
- Comparing the oauth2.py in this PR to an existing implementation
msal/oauth2cli/oauth2.py
Outdated
@@ -35,13 +34,12 @@ def __init__( | |||
self, | |||
server_configuration, # type: dict | |||
client_id, # type: str | |||
http_client, # type: HttpClient |
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.
Historically, that internal variable in this oauth2.py was named session
, serving as a strong hint for the caller to provide a session instance, rather than just an http client instance. I would suggest to follow that prevailing tradition.
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.
According to the current implementation, it is an http_client which can also be a session, session will hold true for session objects only which is what we historically do. But http_client is what we expect, if the passed http client is a session object it still a http_client as we assume it is supposed to have qualities similar to that http_client interface.
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 entire file looks in good shape. And, as part of the final cross-check, I compare it to my async branch, and notice some line(s) are missing/different. A few of them are actually important.
At this point, rather than pointing them out one-by-one in this PR (which would be very time-consuming) and then you need to hand-pick them, we can probably just download this file into your laptop, and then, either run a "diff" to see the difference, or you can just use it and see the tests presumably still pass.
(Note that I've changed my previous session
naming to adopt your http_client
, so you can use it as a drop-in replacement.)
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.
Captured most (if not all) of our recent conversations, as well as some quick Github Suggestios.
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.
Almost there. Added a comment on MinimalResponse
. And the rest of the comments are all one-click suggestions.
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.
Let's have some finishing touch. Look forward to merge at early next week!
msal/oauth2cli/oauth2.py
Outdated
@@ -35,13 +34,12 @@ def __init__( | |||
self, | |||
server_configuration, # type: dict | |||
client_id, # type: str | |||
http_client, # type: HttpClient |
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 entire file looks in good shape. And, as part of the final cross-check, I compare it to my async branch, and notice some line(s) are missing/different. A few of them are actually important.
At this point, rather than pointing them out one-by-one in this PR (which would be very time-consuming) and then you need to hand-pick them, we can probably just download this file into your laptop, and then, either run a "diff" to see the difference, or you can just use it and see the tests presumably still pass.
(Note that I've changed my previous session
naming to adopt your http_client
, so you can use it as a drop-in replacement.)
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.
LOVE IT! Squash it! Merge it!
Separating everything related to requests to http module. Lot of changes around that. I can walk through all the changes.