Skip to content

Commit

Permalink
Update docstrings for request context and samples
Browse files Browse the repository at this point in the history
  • Loading branch information
samwelkanda committed Jun 17, 2021
1 parent 77e5b4c commit 1edfb90
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions msgraph/core/_graph_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


def attach_context(func):
"""Attaches a request context object to every graph request"""
def wrapper(*args, **kwargs):
middleware_control = dict()

Expand Down
15 changes: 15 additions & 0 deletions msgraph/core/middleware/request_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@


class RequestContext:
"""A request context contains data that is persisted throughout the request and
includes a ClientRequestId property, MiddlewareControl property to control behavior
of middleware as well as a FeatureUsage  property to keep track of middleware used
in making the request.
"""
def __init__(self, middleware_control, headers):
"""Constructor for request context instances
Args:
middleware_control (dict): A dictionary of optional middleware options
that can be accessed by middleware components to override the options provided
during middleware initialization,
headers (dict): A dictionary containing the request headers. Used to check for a
user provided client request id.
"""
self.middleware_control = middleware_control
self.client_request_id = headers.get('client-request-id', str(uuid.uuid4()))
self._feature_usage = FeatureUsageFlag.NONE
Expand Down
2 changes: 1 addition & 1 deletion samples/retry_handler_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def sample_http_client_with_custom_retry_defaults():
"""
Initializing a sample client with default middleware using the HTTPClientand passing
Initializing a sample client with default middleware using the HTTPClient and passing
default configs to the retryhandler. These defaults will be used for every subsequent
request using the client."""

Expand Down

0 comments on commit 1edfb90

Please sign in to comment.