python-libcloud vcloud连接

2024-04-26 09:33:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用lib cloud连接Vcloud,使用firefox的restapi进行身份验证很好,但是在python中失败了。我错过什么了吗?在

__author__ = 'kshk'
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

import libcloud.security



def testConnection():
    #libcloud.security.VERIFY_SSL_CERT = False
    vcloud = get_driver(Provider.VCLOUD)
    driver = vcloud("login", "passwd", host = "https://portal.vcloud")

    nodes = driver.list_nodes()
    print nodes

def main():
    testConnection()

if __name__ == "__main__":
    main()

输出:

^{pr2}$

Tags: fromimportcloudgetmainlibdefdriver
1条回答
网友
1楼 · 发布于 2024-04-26 09:33:41

您的代码不起作用,因为“host”参数只需要主机名而不是url。在

如果将其更改为:

driver = vcloud("login", "passwd", host="portal.vcloud")

它应该有用。在

相关问题 更多 >