@@ -39,6 +39,7 @@ def call_finished(location_uri, headers, timeout):
39
39
:param location_uri: URI to check the status of API call
40
40
:param headers: HTTP headers
41
41
:param timeout: connect timeout
42
+ :return indication and response tuple
42
43
"""
43
44
logger = logging .getLogger (__name__ )
44
45
@@ -49,9 +50,9 @@ def call_finished(location_uri, headers, timeout):
49
50
50
51
response .raise_for_status ()
51
52
if response .status_code == 202 :
52
- return False
53
+ return False , response
53
54
else :
54
- return True
55
+ return True , response
55
56
56
57
57
58
def wait_for_async_api (response , api_timeout = None , headers = None , timeout = None ):
@@ -71,12 +72,14 @@ def wait_for_async_api(response, api_timeout=None, headers=None, timeout=None):
71
72
start_time = time .time ()
72
73
if api_timeout is None :
73
74
while True :
74
- if call_finished (location_uri , headers , timeout ):
75
+ done , response = call_finished (location_uri , headers , timeout )
76
+ if done :
75
77
break
76
78
time .sleep (1 )
77
79
else :
78
80
for _ in range (api_timeout ):
79
- if call_finished (location_uri , headers , timeout ):
81
+ done , response = call_finished (location_uri , headers , timeout )
82
+ if done :
80
83
break
81
84
time .sleep (1 )
82
85
0 commit comments