Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/sqs_extended_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ def _validate_required_parameters(self, required_params: list, error_message: st

return

def _get_bytes_size_in_bytes(self, b: bytes) -> int:
"""
Responsible for calculating the size of a byte collection in bytes

:b: The byte collection whose size is to be determined.

"""
return len(b)

def _get_string_size_in_bytes(self, s: str) -> int:
"""
Expand Down Expand Up @@ -156,7 +163,7 @@ def _get_message_attributes_size(self, message_attributes: dict) -> int:

binarytype_value = value.get("BinaryValue", 0)
if binarytype_value:
total_message_attributes_size += self.get_string_size_in_bytes(binarytype_value)
total_message_attributes_size += self.get_bytes_size_in_bytes(binarytype_value)

return total_message_attributes_size

Expand Down Expand Up @@ -636,6 +643,7 @@ def add_client_attributes(self, class_attributes, **kwargs):
_delete_delete_payload_from_s3
)

class_attributes["get_bytes_size_in_bytes"] = _get_bytes_size_in_bytes
class_attributes["get_string_size_in_bytes"] = _get_string_size_in_bytes
class_attributes["get_reserved_attribute_name_if_present"] = _get_reserved_attribute_name_if_present
class_attributes["get_s3_key"] = _get_s3_key
Expand Down