0

使用该 apache libloud 文档和有效凭据,我在尝试在 godaddy 上列出域时遇到以下错误。libcloud noi 不再支持 Godaddy 了吗?

>>> from libcloud.dns.types import Provider
>>> from libcloud.dns.providers import get_driver
>>> cls = get_driver(Provider.GODADDY)
>>> driver = cls('twst', 'adfadf', 'dsdfsdf')
>>> zones = driver.list_zones()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/libcloud/dns/drivers/godaddy.py", line 146, in list_zones
    '/v1/domains/').object
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 782, in request
    headers=headers)
  File "/usr/lib/python2.7/httplib.py", line 979, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1013, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 975, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 835, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 797, in send
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/libcloud/httplib_ssl.py", line 266, in connect
    self.timeout)
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known
>>> 
4

1 回答 1

1

看起来驱动程序中存在错误。连接类上的“主机”属性被错误地设置为 URL 而不是主机名。

我为此推送了一个修复程序 - https://github.com/apache/libcloud/commit/a3ba6a4751623224f16175df9175ec06b29cdc1a

您可以通过使用 pip 从 git 安装最新的开发版本来测试此更改 -pip install git+https://git-wip-us.apache.org/repos/asf/libcloud.git@trunk#egg=apache-libcloud

我已确认更改在本地有效,但如果您遇到任何其他问题,请告诉我们。

from libcloud.dns.types import Provider
from libcloud.dns.providers import get_driver
cls = get_driver(Provider.GODADDY)
driver = cls('twst', 'adfadf', 'dsdfsdf')
print driver.list_zones()
...
libcloud.dns.drivers.godaddy.GoDaddyDNSException: <GoDaddyDNSException in MALFORMED_API_KEY: Malformed API key>

除此之外,我还将继续推送更改,以便在“主机”属性设置为不是主机名的值时引发更友好的异常。

于 2016-02-23T08:59:51.987 回答