Skip to content

Commit 7872820

Browse files
committed
Accept custom client and request options
1 parent dd6823e commit 7872820

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

msgraph/graph_request_adapter.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
from typing import Dict, Optional
22
import httpx
33
from kiota_abstractions.authentication import AuthenticationProvider
4-
from msgraph_core import BaseGraphRequestAdapter, GraphClientFactory
4+
from msgraph_core import APIVersion, BaseGraphRequestAdapter, GraphClientFactory
5+
from msgraph_core.middleware.options import GraphTelemetryHandlerOption
6+
7+
from ._version import VERSION
8+
9+
options = {GraphTelemetryHandlerOption().get_key(): GraphTelemetryHandlerOption(api_version=APIVersion.v1, sdk_version=VERSION)}
510

611

712
class GraphRequestAdapter(BaseGraphRequestAdapter):
8-
def __init__(self, auth_provider: AuthenticationProvider, client: Optional[httpx.AsyncClient] = GraphClientFactory.create_with_default_middleware()) -> None:
13+
def __init__(self, auth_provider: AuthenticationProvider,
14+
client: Optional[httpx.AsyncClient] = GraphClientFactory.create_with_default_middleware(options=options)) -> None:
915
super().__init__(auth_provider, http_client=client)
1016

0 commit comments

Comments
 (0)