timothymugayi / boto3-sqs-extended-client-lib

Boto3 SQS Extended Client Library for Python. An extension to the boto3 sqs client that enables sending and receiving messages up to 2GB via Amazon S3. [WARNING: This library is still under development contributors welcome]
Apache License 2.0
27 stars 23 forks source link

Message body size calculation uses wrong method #3

Closed Maximilian-Staab closed 4 years ago

Maximilian-Staab commented 5 years ago

In SQSClientExtended.__is_large(_, _), msg_body_size is calculated using __get_msg_attributes_size(message). This results in an AttributeError.

Proposition: Use __get_string_size_in_bytes(message) instead.

Steps to reproduce:

sqs = SQSClientExtended(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION, BUCKET_NAME)
sqs.always_through_s3 = False

sqs.send_message(AWS_SQS_QUEUE_URL, "random test string")