[英]Accessing Amazon Web Services SQS Queue in Python
I currently have an Amazon Web Services SQS queue which I use throughout my php project. 我目前有一个Amazon Web Services SQS队列,可在整个php项目中使用。 I am trying to now write a service in Python which adds items to the SQS queue.
我现在尝试用Python编写一个将项目添加到SQS队列的服务。 However I cannot get a connection to my existing queue.
但是,我无法连接到现有队列。 The code I have is:
我的代码是:
import boto.sqs
from boto.sqs.message import Message
conn = boto.sqs.connect_to_region('us-west-2', aws_access_key_id='my key', aws_secret_access_key='my secret key')
print(conn.get_all_queues())
When I run the above code I get an empty array back instead of my current queue. 当我运行上面的代码时,我得到一个空数组,而不是我当前的队列。 Any ideas why this is happening or how to fix it?
有什么想法为什么会发生或如何解决? Thanks.
谢谢。
只要具有URL和SQSConnection对象,就可以直接创建对象。
q = Queue(connection, url)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.