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

Function _handle_bytes_response

awscli/botocore/httpchecksum.py:575–585  ·  view source on GitHub ↗
(http_response, response, algorithm)

Source from the content-addressed store, hash-verified

573
574
575def _handle_bytes_response(http_response, response, algorithm):
576 body = http_response.content
577 header_name = f"x-amz-checksum-{algorithm}"
578 checksum_cls = _CHECKSUM_CLS.get(algorithm)
579 checksum = checksum_cls()
580 checksum.update(body)
581 expected = response["headers"][header_name]
582 if checksum.digest() != base64.b64decode(expected):
583 error_msg = f"Expected checksum {expected} did not match calculated checksum: {checksum.b64digest()}"
584 raise FlexibleChecksumError(error_msg=error_msg)
585 return body
586
587
588_CHECKSUM_CLS = {

Callers 1

handle_checksum_bodyFunction · 0.85

Calls 4

b64digestMethod · 0.80
updateMethod · 0.45
digestMethod · 0.45

Tested by

no test coverage detected