Skip to content

Commit 9d29158

Browse files
authored
Merge pull request #326 from AzureAD/retry-connection-error
Enable retry on connection error
2 parents d3b772c + 090270d commit 9d29158

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

msal/application.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ def __init__(
241241
# But you can patch that (https://github.com/psf/requests/issues/3341):
242242
self.http_client.request = functools.partial(
243243
self.http_client.request, timeout=timeout)
244+
245+
# Enable a minimal retry. Better than nothing.
246+
# https://github.com/psf/requests/blob/v2.25.1/requests/adapters.py#L94-L108
247+
a = requests.adapters.HTTPAdapter(max_retries=1)
248+
self.http_client.mount("http://", a)
249+
self.http_client.mount("https://", a)
250+
244251
self.app_name = app_name
245252
self.app_version = app_version
246253
self.authority = Authority(

0 commit comments

Comments
 (0)