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

Method send

awscli/botocore/httpsession.py:453–517  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

451 manager.clear()
452
453 def send(self, request):
454 try:
455 proxy_url = self._proxy_config.proxy_url_for(request.url)
456 manager = self._get_connection_manager(request.url, proxy_url)
457 conn = manager.connection_from_url(request.url)
458 self._setup_ssl_cert(conn, request.url, self._verify)
459 if ensure_boolean(
460 os.environ.get('BOTO_EXPERIMENTAL__ADD_PROXY_HOST_HEADER', '')
461 ):
462 # This is currently an "experimental" feature which provides
463 # no guarantees of backwards compatibility. It may be subject
464 # to change or removal in any patch version. Anyone opting in
465 # to this feature should strictly pin botocore.
466 host = urlparse(request.url).hostname
467 conn.proxy_headers['host'] = host
468
469 request_target = self._get_request_target(request.url, proxy_url)
470 urllib_response = conn.urlopen(
471 method=request.method,
472 url=request_target,
473 body=request.body,
474 headers=request.headers,
475 retries=Retry(False),
476 assert_same_host=False,
477 preload_content=False,
478 decode_content=False,
479 chunked=self._chunked(request.headers),
480 )
481
482 http_response = botocore.awsrequest.AWSResponse(
483 request.url,
484 urllib_response.status,
485 urllib_response.headers,
486 urllib_response,
487 )
488
489 if not request.stream_output:
490 # Cause the raw stream to be exhausted immediately. We do it
491 # this way instead of using preload_content because
492 # preload_content will never buffer chunked responses
493 http_response.content
494
495 return http_response
496 except URLLib3SSLError as e:
497 raise SSLError(endpoint_url=request.url, error=e)
498 except (NewConnectionError, socket.gaierror) as e:
499 raise EndpointConnectionError(endpoint_url=request.url, error=e)
500 except ProxyError as e:
501 raise ProxyConnectionError(
502 proxy_url=mask_proxy_url(proxy_url), error=e
503 )
504 except URLLib3ConnectTimeoutError as e:
505 raise ConnectTimeoutError(endpoint_url=request.url, error=e)
506 except URLLib3ReadTimeoutError as e:
507 raise ReadTimeoutError(endpoint_url=request.url, error=e)
508 except ProtocolError as e:
509 raise ConnectionClosedError(
510 error=e, request=request, endpoint_url=request.url

Calls 14

_setup_ssl_certMethod · 0.95
_get_request_targetMethod · 0.95
_chunkedMethod · 0.95
SSLErrorClass · 0.90
ConnectTimeoutErrorClass · 0.90
ReadTimeoutErrorClass · 0.90
HTTPClientErrorClass · 0.90
mask_proxy_urlFunction · 0.85