-
Notifications
You must be signed in to change notification settings - Fork 43
Feat/request context #83
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 2 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
db201d0
Add request context
samwelkanda f11df7e
Fix failing tests on middleware pipeline
samwelkanda f8d98e5
Move feature usage flags into an enum
samwelkanda 4af870b
Set correct value for logging enabled flag
samwelkanda 68b0993
Pass kwargs when instantiating graph client with default middleware
samwelkanda 734c78b
Pass headers instead of request object when creating a context object
samwelkanda eeeb166
Remove use of middleware options bag
samwelkanda b9e7cbf
Update feature usage flag in auth handler
samwelkanda a9cf227
Request context design
jobala 75c76fc
Minor adjustments
samwelkanda fcd0b59
Clean up
jobala 3a71196
Merge branch 'experiment/request-context' of github.com:microsoftgrap…
jobala 32cd377
Remove middleware control and options folder as no longer needed
samwelkanda 508208b
Refactor failing tests
samwelkanda c280dbd
Merge pull request #87 from microsoftgraph/experiment/request-context
samwelkanda f723cb7
Pin dependencies to specific versions
samwelkanda 19bf0f9
Replace abbreviated variable names with full names
samwelkanda 644bfe1
Merge branch 'dev' into feat/request-context
samwelkanda 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
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
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,25 @@ | ||
import uuid | ||
|
||
from msgraphcore.middleware.options.middleware_control import middleware_control | ||
|
||
|
||
class RequestContext: | ||
NONE_FLAG = 0 | ||
REDIRECT_HANDLER_ENABLED_FLAG = 1 | ||
RETRY_HANDLER_ENABLED_FLAG = 2 | ||
AUTH_HANDLER_ENABLED_FLAG = 4 | ||
DEFAULT_HTTPROVIDER_ENABLED_FLAG = 8 | ||
LOGGING_HANDLER_ENABLED_FLAG = 10 | ||
|
||
def __init__(self, request): | ||
self.middleware_control = middleware_control | ||
self.client_request_id = request.headers.get('client-request-id', str(uuid.uuid4())) | ||
self._feature_usage = self.NONE_FLAG | ||
|
||
@property | ||
def feature_usage(self): | ||
return hex(self._feature_usage) | ||
|
||
@feature_usage.setter | ||
def set_feature_usage(self, flag): | ||
self._feature_usage = self.feature_usage | flag |
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
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.