简体   繁体   中英

Accessing Amazon Web Services SQS Queue in Python

I currently have an Amazon Web Services SQS queue which I use throughout my php project. I am trying to now write a service in Python which adds items to the SQS queue. 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM