MCPcopy Create free account
hub / github.com/aws/aws-cli / _should_compress_request

Function _should_compress_request

awscli/botocore/compress.py:45–66  ·  view source on GitHub ↗
(config, request_dict, operation_model)

Source from the content-addressed store, hash-verified

43
44
45def _should_compress_request(config, request_dict, operation_model):
46 if (
47 config.disable_request_compression is not True
48 and config.signature_version != 'v2'
49 and operation_model.request_compression is not None
50 ):
51 if not _is_compressible_type(request_dict):
52 body_type = type(request_dict['body'])
53 log_msg = 'Body type %s does not support compression.'
54 logger.debug(log_msg, body_type)
55 return False
56
57 if operation_model.has_streaming_input:
58 streaming_input = operation_model.get_streaming_input()
59 streaming_metadata = streaming_input.metadata
60 return 'requiresLength' not in streaming_metadata
61
62 body_size = _get_body_size(request_dict['body'])
63 min_size = config.request_min_compression_size_bytes
64 return min_size <= body_size
65
66 return False
67
68
69def _is_compressible_type(request_dict):

Callers 1

maybe_compress_requestFunction · 0.85

Calls 3

_is_compressible_typeFunction · 0.85
_get_body_sizeFunction · 0.85
get_streaming_inputMethod · 0.80

Tested by

no test coverage detected