MCPcopy Index your code
hub / github.com/aws/aws-cli / _send_request

Method _send_request

awscli/botocore/endpoint.py:190–229  ·  view source on GitHub ↗
(self, request_dict, operation_model)

Source from the content-addressed store, hash-verified

188 self._set_ttl(retries_context, read_timeout, success_response)
189
190 def _send_request(self, request_dict, operation_model):
191 attempts = 1
192 context = request_dict['context']
193 self._update_retries_context(context, attempts)
194 request = self.create_request(request_dict, operation_model)
195 success_response, exception = self._get_response(
196 request, operation_model, context
197 )
198 while self._needs_retry(
199 attempts,
200 operation_model,
201 request_dict,
202 success_response,
203 exception,
204 ):
205 attempts += 1
206 self._update_retries_context(context, attempts, success_response)
207 # If there is a stream associated with the request, we need
208 # to reset it before attempting to send the request again.
209 # This will ensure that we resend the entire contents of the
210 # body.
211 request.reset_stream()
212 # Create a new request when retried (including a new signature).
213 request = self.create_request(request_dict, operation_model)
214 success_response, exception = self._get_response(
215 request, operation_model, context
216 )
217 if (
218 success_response is not None
219 and 'ResponseMetadata' in success_response[1]
220 ):
221 # We want to share num retries, not num attempts.
222 total_retries = attempts - 1
223 success_response[1]['ResponseMetadata']['RetryAttempts'] = (
224 total_retries
225 )
226 if exception is not None:
227 raise exception
228 else:
229 return success_response
230
231 def _get_response(self, request, operation_model, context):
232 # This will return a tuple of (success_response, exception)

Callers 1

make_requestMethod · 0.95

Calls 5

create_requestMethod · 0.95
_get_responseMethod · 0.95
_needs_retryMethod · 0.95
reset_streamMethod · 0.80

Tested by

no test coverage detected