@@ -112,30 +112,28 @@ def send(self, request, **kwargs):
112112 retry_valid = True
113113
114114 while retry_valid :
115- try :
116- start_time = time . time ()
115+ start_time = time . time ()
116+ if retry_count > 0 :
117117 request .headers .update ({'retry-attempt' : '{}' .format (retry_count )})
118- response = super ().send (request , ** kwargs )
119- # Check if the request needs to be retried based on the response method
120- # and status code
121- if self .should_retry (retry_options , response ):
122- # check that max retries has not been hit
123- retry_valid = self .check_retry_valid (retry_options , retry_count )
124-
125- # Get the delay time between retries
126- delay = self .get_delay_time (retry_options , retry_count , response )
127-
128- if retry_valid and delay < absolute_time_limit :
129- time .sleep (delay )
130- end_time = time .time ()
131- absolute_time_limit -= (end_time - start_time )
132- # increment the count for retries
133- retry_count += 1
134-
135- continue
136- break
137- except Exception as error :
138- raise error
118+ response = super ().send (request , ** kwargs )
119+ # Check if the request needs to be retried based on the response method
120+ # and status code
121+ if self .should_retry (retry_options , response ):
122+ # check that max retries has not been hit
123+ retry_valid = self .check_retry_valid (retry_options , retry_count )
124+
125+ # Get the delay time between retries
126+ delay = self .get_delay_time (retry_options , retry_count , response )
127+
128+ if retry_valid and delay < absolute_time_limit :
129+ time .sleep (delay )
130+ end_time = time .time ()
131+ absolute_time_limit -= (end_time - start_time )
132+ # increment the count for retries
133+ retry_count += 1
134+
135+ continue
136+ break
139137 return response
140138
141139 def should_retry (self , retry_options , response ):
0 commit comments