jeudi 30 juillet 2015

(python/boto sqs) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)

I can not send messages with accented characters for SQS in python with the AWS SDK (boto).

Versions

Python: 2.7.6 boto: 2.20.1

CODE

   #!/usr/bin/env python
   # -*- coding: utf-8 -*-

import boto.sqs
from boto.sqs.message import RawMessage

    # print boto.Version
sqs_conn = boto.sqs.connect_to_region(
'my_region',
aws_access_key_id='my_kye',
aws_secret_access_key='my_secret_ky')
queue = sqs_conn.get_queue('my_queue')
queue.set_message_class(RawMessage)

msg = RawMessage()

body = '1 café, 2 cafés, 3 cafés ...'
msg.set_body(body)
queue.write(msg)




Aucun commentaire:

Enregistrer un commentaire