Skip to content

Commit 2f2dc95

Browse files
committed
Explicity name default values
1 parent 6f0c354 commit 2f2dc95

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

msgraph/core/_client_factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from requests import Session
88

9-
from ._constants import CONNECTION_TIMEOUT, REQUEST_TIMEOUT
9+
from ._constants import DEFAULT_CONNECTION_TIMEOUT, DEFAULT_REQUEST_TIMEOUT
1010
from ._enums import APIVersion, NationalClouds
1111
from .middleware.abc_token_credential import TokenCredential
1212
from .middleware.authorization import AuthorizationHandler
@@ -37,7 +37,7 @@ def __init__(self, **kwargs):
3737
to configure the request handling behaviour of the client"""
3838
self.api_version = kwargs.get('api_version', APIVersion.v1)
3939
self.endpoint = kwargs.get('cloud', NationalClouds.Global)
40-
self.timeout = kwargs.get('timeout', (CONNECTION_TIMEOUT, REQUEST_TIMEOUT))
40+
self.timeout = kwargs.get('timeout', (DEFAULT_CONNECTION_TIMEOUT, DEFAULT_REQUEST_TIMEOUT))
4141
self.session = kwargs.get('session', Session())
4242

4343
self._set_base_url()

msgraph/core/_constants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# Licensed under the MIT License.
44
# ------------------------------------
55
"""
6-
Application constants
6+
Application constants. All defaults can be changed when initializing a client
7+
via the GraphClient or HttpClientFactory
78
"""
8-
REQUEST_TIMEOUT = 100
9-
CONNECTION_TIMEOUT = 30
10-
BASE_URL = 'https://graph.microsoft.com/'
9+
DEFAULT_REQUEST_TIMEOUT = 100
10+
DEFAULT_CONNECTION_TIMEOUT = 30
1111
SDK_VERSION = '0.1.0'

tests/unit/test_client_factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from requests.adapters import HTTPAdapter
88

99
from msgraph.core import APIVersion, HTTPClientFactory, NationalClouds
10-
from msgraph.core._constants import CONNECTION_TIMEOUT, REQUEST_TIMEOUT
10+
from msgraph.core._constants import DEFAULT_CONNECTION_TIMEOUT, DEFAULT_REQUEST_TIMEOUT
1111
from msgraph.core.middleware.authorization import AuthorizationHandler
1212

1313

@@ -18,7 +18,7 @@ def test_initialize_with_default_config():
1818

1919
assert client.api_version == APIVersion.v1
2020
assert client.endpoint == NationalClouds.Global
21-
assert client.timeout == (CONNECTION_TIMEOUT, REQUEST_TIMEOUT)
21+
assert client.timeout == (DEFAULT_CONNECTION_TIMEOUT, DEFAULT_REQUEST_TIMEOUT)
2222
assert isinstance(client.session, Session)
2323

2424

tests/unit/test_graph_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from requests.adapters import HTTPAdapter
99

1010
from msgraph.core import APIVersion, GraphClient, NationalClouds
11-
from msgraph.core._constants import CONNECTION_TIMEOUT, REQUEST_TIMEOUT
1211
from msgraph.core.middleware.authorization import AuthorizationHandler
1312

1413

0 commit comments

Comments
 (0)