#python-digitalocean
python-digitalocean is a python package that provide easy access to digitalocean.com APIs to manage droplets, images and more.
You can install python-digitalocean using pip
pip install -U python-digitalocean
or via sources:
python setup.py install
python-digitalocean support all the features provided via digitalocean.com APIs, such as:
- Get user's Droplets
- Get user's Images (Snapshot and Backups)
- Get public Images
- Get Droplet's event status
- Create and Remove a Droplet
- Resize a Droplet
- Shutdown, restart and boot a Droplet
- Power off, power on and "power cycle" a Droplet
- Perform Snapshot
- Enable/Disable automatic Backups
- Restore root password of a Droplet
## Examples
This example shows how to shutdown all the active droplets:
import digitalocean
manager = digitalocean.Manager(client_id="ABC", api_key="ABC")
my_droplets = manager.get_all_droplets()
for droplet in my_droplets:
droplet.shutdown()
This example shows how to create a droplet and how to check its status
import digitalocean
droplet = digitalocean.Droplet(client_id=client_id,
api_key=api_key,
name = 'Example',
region_id=1 #New York,
image_id=2676 #Ubuntu 12.04 x64 Server,
size_id=66 #512MB,
backup_active=False)
droplet.create()
events = droplet.get_events()
for event in events:
event.load()
#Once it shows 100, droplet is up and running
print event.percentage
- Project Site: http://projects.setale.me/python-digitalocean
- GitHub: https://github.com/koalalorenzo/python-digitalocean
- PyPi page: https://pypi.python.org/pypi/python-digitalocean/
- Author Website: http://who.is.lorenzo.setale.me/?
- Author Blog: http://blog.setale.me/
