0
我正在使用SoftLayer中的Message Queue服務。我創建了一個隊列,裏面有幾條消息,我試圖從Python腳本中讀取它們。從SoftLayer Message Queue中讀取
我已經安裝了以下Python包https://github.com/softlayer/softlayer-message-queue-python。這裏是我的測試文件看起來像:
from softlayer_messaging.queue import Queue, Message
from softlayer_messaging.compat import json
from softlayer_messaging.auth import QueueAuth
from softlayer_messaging.errors import Unauthenticated
if __name__ == '__main__':
endpoint = "{I'm using the public host from my Message Queue credentials}"
username = "{My username}"
api_key = "{My API account key}"
auth_token = None
auth = QueueAuth(
endpoint, username, api_key,
auth_token=auth_token)
auth.auth()
queue = Queue(endpoint, "domains", auth)
print queue.detail()
如果我調用auth.auth()方法之後顯示的auth_token,那麼它顯示了一個隨機字符串,所以我相信在認證corectly完成。
的問題是queue.detail()方法拋出以下異常:
File "test1.py", line 23, in <module>
print queue.detail()
File "/usr/local/lib/python2.7/site-packages/softlayer_messaging/queue.py", line 24, in detail
return self.get().json
File "/usr/local/lib/python2.7/site-packages/softlayer_messaging/resource.py", line 23, in get
return self.request('GET', *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/softlayer_messaging/queue.py", line 20, in request
resp.raise_for_status()
File "/usr/local/lib/python2.7/site-packages/softlayer_messaging/resource.py", line 84, in raise_for_status
raise ResponseError("%s: %s" % (code, message), errors)
softlayer_messaging.errors.ResponseError: 404: Not found
我能夠連接到隊列和讀取從PHP腳本中的消息,所以我很確定問題不在隊列本身。關於我在做什麼的任何想法都是錯誤的?
非常感謝您的幫助。