Skip to content

Instantly share code, notes, and snippets.

Created September 5, 2013 16:28
  • Star 10 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Minimal script for sending/reading from Amazon SQS using Boto/Python.
conf = {
"sqs-access-key": "",
"sqs-secret-key": "",
"sqs-queue-name": "",
"sqs-region": "us-east-1",
"sqs-path": "sqssend"
import boto.sqs
conn = boto.sqs.connect_to_region(
aws_access_key_id = conf.get('sqs-access-key'),
aws_secret_access_key = conf.get('sqs-secret-key')
q = conn.create_queue(conf.get('sqs-queue-name'))
from boto.sqs.message import RawMessage
m = RawMessage()
m.set_body('Reader started at this point.')
retval = q.write(m)
print 'added message, got retval: %s' % retval
import time
for m in q.get_messages():
print '%s: %s' % (m, m.get_body())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment