Using python BOTO with AWS SQS, getting extra characters

So, I use python and BOTO to access my AWS SQS. I have messages in SQS that I see in the AWS control panel. However, when I try to get these messages through python, the characters that go through are just gibberish. Any idea what is going on here?

conn = boto.sqs.connect_to_region("us-east-1") 
q = conn.get_queue('my-worker-queue')
print q 
#read from message queue
message = q.read(60)
print message
print message.get_body()

Given the code above, I get the following:

Queue(https://queue.amazonaws.com/247124526695/my-worker-queue)
<boto.sqs.message.Message instance at 0x16f31b8>
??e??b?+??-

The text in the message queue is as follows:

hello this is a test
+4
source share
1 answer

, base64, boto base64 . get_body_encoded:

print message.get_body_encoded()

RawMessage:

from boto.sqs.message import RawMessage
q.set_message_class(RawMessage)

, :

>>> print 'hello this is a test'.decode('base64')
??e??b?+??-
+6

All Articles