1

I am using Python 2.7 and boto library for Amazon SNS. I am trying to send a notification when I get an exception with detail of the exception. In some cases exception string contains strings like this "--->" or " \ ". I suspect these characters causing BotoServerError as a Bad Request.

Full exception string:

boto.exception.BotoServerError: BotoServerError: 400 Bad Request None

What is the best way of preventing my application from this exception?

Edit: Here is the code that I am sending message:

sns = boto.sns.connect_to_region(credentials...)
sns.publish(topicArn, message, subject)

This is message:

Type: <type 'exceptions.ValueError'>
Detail: ('invalid literal for int() with base 10: \'{"default":"216","sqs":"216"}\'',)
huzeyfe
  • 3,554
  • 6
  • 39
  • 49
  • Could you post your code somewhere? – garnaat Aug 14 '12 at 13:04
  • @garnaat thanks for your attention. I've just edited question to include code sample.. – huzeyfe Aug 14 '12 at 13:12
  • The first parameter boto.sns.connect_to_region should be a region_name. Is that just a cut/paste error? Or are you forgetting the region_name in the call? – garnaat Aug 14 '12 at 16:46
  • @garnaat No no I just wanted to refer my credentials not to write all of them here.. My module is working fine in most messages. But sometimes if there are some specials chars I get an exception. – huzeyfe Aug 15 '12 at 07:42

0 Answers0