来自python-digitalocean的ip

时间:2018-12-07 14:58:55

标签: python-3.x digital-ocean

使用python-digitalocean模块。

我要在创建Droplet之后抓取ipv4。

actions = droplet.get_actions()
for action in actions:
    while action.status != 'completed':
        action.load()
        # Once it shows complete, droplet is up and running
        print (action.status)
print(droplet.ip_address)

这将返回None

谢谢!

1 个答案:

答案 0 :(得分:0)

您必须刷新液滴数据,尝试像这样

droplet.load()
print(droplet.ip_address)