Skip to content

Commit d65ef80

Browse files
authored
Merge pull request #891 from H-PRessl/master
add exceptions parameter to client_result.execute_query_retry to mirror client_runtime_context.execute_query_retry
2 parents 9c96d60 + db94116 commit d65ef80

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

office365/runtime/client_object.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def execute_query_retry(
6161
timeout_secs=5,
6262
success_callback=None,
6363
failure_callback=None,
64-
exceptions=(ClientRequestException,)
64+
exceptions=(ClientRequestException,),
6565
):
6666
"""
6767
Executes the current set of data retrieval queries and method invocations and retries it if needed.
@@ -79,7 +79,7 @@ def execute_query_retry(
7979
timeout_secs=timeout_secs,
8080
success_callback=success_callback,
8181
failure_callback=failure_callback,
82-
exceptions=exceptions
82+
exceptions=exceptions,
8383
)
8484
return self
8585

office365/runtime/client_result.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from typing_extensions import Self
55

6+
from office365.runtime.client_request_exception import ClientRequestException
67
from office365.runtime.http.request_options import RequestOptions
78

89
if TYPE_CHECKING:
@@ -54,13 +55,29 @@ def execute_query(self):
5455
return self
5556

5657
def execute_query_retry(
57-
self, max_retry=5, timeout_secs=5, success_callback=None, failure_callback=None
58+
self,
59+
max_retry=5,
60+
timeout_secs=5,
61+
success_callback=None,
62+
failure_callback=None,
63+
exceptions=(ClientRequestException,),
5864
):
59-
"""Executes the current set of data retrieval queries and method invocations and retries it if needed."""
65+
"""
66+
Executes the current set of data retrieval queries and method invocations and retries it if needed.
67+
68+
:param int max_retry: Number of times to retry the request
69+
:param int timeout_secs: Seconds to wait before retrying the request.
70+
:param (office365.runtime.client_object.ClientObject)-> None success_callback: A callback to call
71+
if the request executes successfully.
72+
:param (int, requests.exceptions.RequestException)-> None failure_callback: A callback to call if the request
73+
fails to execute
74+
:param exceptions: tuple of exceptions that we retry
75+
"""
6076
self._context.execute_query_retry(
6177
max_retry=max_retry,
6278
timeout_secs=timeout_secs,
6379
success_callback=success_callback,
6480
failure_callback=failure_callback,
81+
exceptions=exceptions,
6582
)
6683
return self

0 commit comments

Comments
 (0)