From 628c748ba3aa0aa520bc07d51d2c62d4e4315d56 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Thu, 19 Oct 2023 16:42:56 +0300 Subject: [PATCH 1/3] Enable /me URL replacement --- msgraph/graph_request_adapter.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/msgraph/graph_request_adapter.py b/msgraph/graph_request_adapter.py index 40583628a92..c4c213400e9 100644 --- a/msgraph/graph_request_adapter.py +++ b/msgraph/graph_request_adapter.py @@ -6,7 +6,15 @@ from ._version import VERSION -options = {GraphTelemetryHandlerOption.get_key(): GraphTelemetryHandlerOption(api_version=APIVersion.beta, sdk_version=VERSION)} +options = { + UrlReplaceHandlerOption.get_key(): UrlReplaceHandlerOption( + enabled = True, + replacement_pairs = {"/users/me-token-to-replace": "/me"} + ), + GraphTelemetryHandlerOption.get_key(): GraphTelemetryHandlerOption( + api_version=APIVersion.beta, + sdk_version=VERSION) +} class GraphRequestAdapter(BaseGraphRequestAdapter): def __init__(self, auth_provider: AuthenticationProvider, From 5180d15b2dcd998f23562f2895ef8c70ccaa0b38 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Thu, 19 Oct 2023 16:55:58 +0300 Subject: [PATCH 2/3] Import UrlReplaceHandlerOption --- msgraph/graph_request_adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msgraph/graph_request_adapter.py b/msgraph/graph_request_adapter.py index c4c213400e9..98f5ec9a636 100644 --- a/msgraph/graph_request_adapter.py +++ b/msgraph/graph_request_adapter.py @@ -2,7 +2,7 @@ import httpx from kiota_abstractions.authentication import AuthenticationProvider from msgraph_core import APIVersion, BaseGraphRequestAdapter, GraphClientFactory -from msgraph_core.middleware.options import GraphTelemetryHandlerOption +from msgraph_core.middleware.options import GraphTelemetryHandlerOption, UrlReplaceHandlerOption from ._version import VERSION From 0f344e41aa60d403f0644933ed1d70bd492386a7 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Thu, 19 Oct 2023 17:03:20 +0300 Subject: [PATCH 3/3] Update import --- msgraph/graph_request_adapter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/msgraph/graph_request_adapter.py b/msgraph/graph_request_adapter.py index 98f5ec9a636..52e3ecb6566 100644 --- a/msgraph/graph_request_adapter.py +++ b/msgraph/graph_request_adapter.py @@ -1,8 +1,9 @@ from typing import Dict, Optional import httpx from kiota_abstractions.authentication import AuthenticationProvider +from kiota_http.middleware.options import UrlReplaceHandlerOption from msgraph_core import APIVersion, BaseGraphRequestAdapter, GraphClientFactory -from msgraph_core.middleware.options import GraphTelemetryHandlerOption, UrlReplaceHandlerOption +from msgraph_core.middleware.options import GraphTelemetryHandlerOption from ._version import VERSION