-
Notifications
You must be signed in to change notification settings - Fork 207
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
cbe98f3
Initial commit
abhidnya13 e64332f
Iteration 1
abhidnya13 2a7d5e3
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
abhidnya13 aed0e8d
Iteration 2 rectifying tests
abhidnya13 30f7d99
Iteration 3 modifying some more failing tests
abhidnya13 34e8e16
Iteration 4
abhidnya13 f60bbb5
Removing tests whose implementation was removed
abhidnya13 d54fb8b
Iteration 5
abhidnya13 be389d5
Replacing generic exception to specific Http error
abhidnya13 dcec4af
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
abhidnya13 e37f0c3
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
abhidnya13 b3a4e09
Refactor according to new interface
abhidnya13 96988f8
Changing one reference to new interface left in the previous one
abhidnya13 1d05615
Modified one more missed change
abhidnya13 ccafcf9
Few more changes and refactor
abhidnya13 2670e25
Adding raw response to response object
abhidnya13 cb70a37
Cleaning None values
abhidnya13 53520fd
PR review iteration
abhidnya13 293b081
Removing default http client
abhidnya13 fcac05e
cleaning up
abhidnya13 229ad26
Adding deleted single empty line back
abhidnya13 340210f
Updating filtering of non values from dictionary
abhidnya13 ca8a129
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
abhidnya13 d993950
Capturing editorial changes
abhidnya13 e5ebd28
Review changes 1
abhidnya13 8901269
Fixing broken test
abhidnya13 7774be8
Cleaning up
abhidnya13 42ca7a2
PR review changes part 1
abhidnya13 d38d38d
PR review changes part 2
abhidnya13 3226bc4
PR review changes part 3
abhidnya13 90afb94
Minor indent change
abhidnya13 a1ce0d1
PR review changes part 4
abhidnya13 ad245a7
Adding back accidentally deleted blank line
abhidnya13 34bb127
Removing extra indent
abhidnya13 a745949
Minor line add in authority.py
abhidnya13 b636baa
Making changes for backward compatibility
abhidnya13 d24d575
Some more editorial changes
abhidnya13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Cleaning None values
- Loading branch information
commit cb70a37cb99f4ffbe3b0958cda0a2a9f689e013c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import httpx | ||
|
|
||
| from .oauth2cli import HttpClient, Response | ||
|
|
||
|
|
||
| class DefaultHttpClient(HttpClient): | ||
| """ | ||
| Default HTTP Client | ||
| """ | ||
| def __init__(self): | ||
| """ | ||
| Constructor for the DefaultHttpClient | ||
| verify=True, # type: Union[str, True, False, None] | ||
| proxies=None, # type: Optional[dict] | ||
| """ | ||
| self.session = httpx.Client() | ||
|
|
||
| def post(self, url, params=None, data=None, headers=None, **kwargs): | ||
| if params is None: | ||
| params = {} | ||
| params.update(**kwargs) | ||
rayluo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| response = self.session.post(url=url, params=params, headers=headers, data=data) | ||
| return Response(response.status_code, response.text, response) | ||
|
|
||
| def get(self, url, params=None, headers=None, **kwargs): | ||
| if params is None: | ||
| params = {} | ||
| params.update(kwargs) | ||
| response = self.session.get(url=url, params=params, headers=headers) | ||
| return Response(response.status_code, response.text, response) | ||
|
|
||
|
|
||
| class Response(Response): | ||
|
|
||
| def __init__(self, status_code, text, response): | ||
| """Constructor for DefaultResponseObject | ||
| status, # type: int | ||
| text, # type: str response in string format | ||
| response, # type: Raw response from requests | ||
| """ | ||
| self.status_code = status_code | ||
| self.text = text | ||
| self.response = response | ||
|
|
||
|
|
||
| def raise_for_status(self): | ||
| self.response.raise_for_status() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import httpx | ||
| from httpx import * | ||
| from msal.oauth2cli import HttpClient, Response | ||
|
|
||
|
|
||
| class HttpxClient(HttpClient): | ||
rayluo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """ | ||
| Default HTTP Client | ||
| """ | ||
| def __init__(self): | ||
| """ | ||
| Constructor for the DefaultHttpClient | ||
| verify=True, # type: Union[str, True, False, None] | ||
| proxies=None, # type: Optional[dict] | ||
| """ | ||
|
|
||
| def post(self, url, params=None, data=None, headers=None, **kwargs): | ||
| if params is None: | ||
| params = {} | ||
| params.update(**kwargs) | ||
|
|
||
| response = httpx.post(url=url, params=params, headers=headers, data=data) | ||
| return Response(response.status_code, response.text, response) | ||
|
|
||
| def get(self, url, params=None, headers=None, **kwargs): | ||
| if params is None: | ||
| params = {} | ||
| params.update(kwargs) | ||
| response = httpx.get(url=url, params=params, headers=headers) | ||
| return Response(response.status_code, response.text, response) | ||
|
|
||
|
|
||
| class Response(Response): | ||
|
|
||
| def __init__(self, status_code, text, response): | ||
| """Constructor for DefaultResponseObject | ||
| status, # type: int | ||
| text, # type: str response in string format | ||
| response, # type: Raw response from requests | ||
| """ | ||
| self.status_code = status_code | ||
| self.text = text | ||
| self.response = response | ||
|
|
||
|
|
||
| def raise_for_status(self): | ||
| self.response.raise_for_status() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.