File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ class Options:
22
22
client_id : str
23
23
client_secret : str
24
24
access_token_url : str
25
+ retry_count : int = 10
26
+ sleep_seconds : int = 3
25
27
26
28
27
29
class Client :
@@ -92,15 +94,16 @@ def _check_upload(
92
94
self ,
93
95
operation_id ,
94
96
access_token : str ,
95
- retry_count : int = 5 ,
96
- sleep_seconds : int = 3 ,
97
97
) -> str :
98
98
logger .debug ("Checking upload" )
99
99
100
100
upload_status = ""
101
101
attempts = 0
102
102
103
- while upload_status != ResponseStatus .SUCCEEDED and attempts < retry_count :
103
+ while (
104
+ upload_status != ResponseStatus .SUCCEEDED
105
+ and attempts < self .options .retry_count
106
+ ):
104
107
response = requests .get (
105
108
self ._status_endpoint (operation_id ),
106
109
headers = {
@@ -121,7 +124,8 @@ def _check_upload(
121
124
response_json ["errors" ],
122
125
)
123
126
elif upload_status == ResponseStatus .IN_PROGRESS :
124
- time .sleep (sleep_seconds )
127
+ time .sleep (self .options .sleep_seconds )
128
+ attempts += 1
125
129
126
130
return upload_status
127
131
You can’t perform that action at this time.
0 commit comments