我正在尝试使用 Python 中的 libcloud api 在 CloudStack 中列出图像:
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
from libcloud.common.base import Response
#import libcloud.security as sec
#sec.VERIFY_SSL_CERT = False
#USER = 'ACCESSKEY'
#API_KEY = 'SECRETKEY'
Driver = get_driver(Provider.CLOUDSTACK)
url = 'MY URL'
conn = Driver(key=USER, secret=API_KEY, url=url)
print "Connection established"
images = conn.list_images()
print images
运行此代码时,我收到以下错误:
body = self.parse_body()
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 195,
in parse_body driver=self.connection.driver)
libcloud.common.types.MalformedResponseError: <MalformedResponseException in
<libcloud.compute.drivers.cloudstack.CloudStackNodeDriver object at 0x7fc356f55b50>
'Failed to parse JSON'>: 'Unknown_ApiKey'
我错过了什么?