Skip to content

Instantly share code, notes, and snippets.

@joenorton8014
Created April 8, 2018 16:54
Show Gist options
  • Save joenorton8014/c11569cdc352e8058eb0ac46cd3d46cf to your computer and use it in GitHub Desktop.
Save joenorton8014/c11569cdc352e8058eb0ac46cd3d46cf to your computer and use it in GitHub Desktop.
import digitalocean
# pip install -U python-digitalocean
# https://github.com/koalalorenzo/python-digitalocean
key = ''
manager = digitalocean.Manager(token=key)
my_droplets = manager.get_all_droplets()
print(my_droplets)
def List_All_VMs(manager):
my_droplets = manager.get_all_droplets()
for vm in my_droplets:
print '\n'
print 'Name: ' + vm.name
print 'IP Address: ' + str(vm.ip_address)
print 'OS: ' + str(vm.image['distribution']) + ' ' + str(vm.image['name'])
print 'Creation Time: ' + vm.created_at
print 'Disk Size: ' + str(vm.disk)
print 'Memory: ' + str(vm.memory)
print 'VCPUs: ' + str(vm.vcpus)
print 'Region: ' + vm.region['name']
print 'SSH Keys: ' + str(vm.ssh_keys)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment