skip to navigation
skip to content

Not Logged In

dio 0.2.9

Python API for DigitalOcean v2.0 REST API

Latest Version: 0.3.10

# Dio v0.2.9

##### Python API for DigitalOcean v2.0 REST API

### How to install

You can install dio using **pip**

pip install -U dio

or via sources:

python setup.py install

--

### Features
* **DROPLET BACKUP!!! (rsync and snapshot a droplet)**
* **Uses digitalocean v2.0 API**
* Running API call count
* Running API remaining call count
* All objects have a details function to return properties and values
* Get user's Droplets
* Get user's Images (Snapshot and Backups)
* Get public Images
* 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

--

### Example cronjob:

```sh
# DigitalOcean backup script
0 * * * * /usr/bin/python /Users/username/bin/backup.py
```

--

### Example backup script:

```python

import dio

""" Your digitalocean API v2.0 token """
token = "YOUR_TOKEN"

""" Ignore list of droplets to bypass in operations """
ignore = ["dev.example.com"]

""" Droplet backup options. Only needed when doing backup """
options = {
"dev.example.com": {
"ssh_user" : "root",
"ssh_key" : "ssh_key",
"backup_dir" : "/Users/username/Droplets",
"remote_dirs" : [ "/root", "/var/log/apt" ],
"use_ip" : True,
"snapshot_hour" : 3,
"snapshots_keep" : 2,
"snapshot_delete" : True,
},
"production.example.com": {
"ssh_user" : "root",
"ssh_key" : "ssh_key",
"backup_dir" : "/Users/username/Droplets",
"remote_dirs" : [ "/var/www", "/etc/nginx" ],
"use_ip" : True,
"snapshot_hour" : 3,
"snapshots_keep" : 7,
"snapshot_delete" : True,
}
}

manager = dio.Manager( token, ignore )

""" backup your droplets with rsync """
for droplet in manager.get_all_droplets():
dio.Backup( options, droplet )
""" creates a backup log in your backup folder """

""" See how many api calls you used """
print dio.api.calls

""" See how many remaining api calls you have left for the hour """
print dio.api.remaining

```

--

### Changelog

#### v0.1
- pypi "python-dio" package was deleted.

#### v0.2
- added full backup function to Backup.py class.
- added backup prompt for Droplet.delete(). Pass in False to bypass prompt
- renamed package from python-dio to dio

#### v0.2.1
- added check to Backup.rsync() to make sure the droplet is on

#### v0.2.2
- changed Droplet.snapshot() to use shutdown instead of power_off.

#### v0.2.3
- hidden token from .details() data

#### v0.2.4
- removed auto droplet population from Manager.droplets

#### v0.2.5
- fixed delete backup snapshot to only delete snapshots created by backup
- fixed manager.get_all_images() to get paginated results
- changed backup option remote_dir to remote_dirs[] so you can rsync multiple directories
- better backup logging

#### v0.2.6
- changed backup log to markdown

#### v0.2.7
- removed log entries for empty rsync

#### v0.2.8
- better support for github flavored markdown in backup log

#### v0.2.9
- variable fixed bug in backup

--

Designed to be compatible with [python-digitalocean]https://github.com/koalalorenzo/python-digitalocean  
File Type Py Version Uploaded on Size
dio-0.2.9.tar.gz (md5) Source 2014-08-17 10KB
  • Downloads (All Versions):
  • 41 downloads in the last day
  • 432 downloads in the last week
  • 1570 downloads in the last month
  • Author: Rob Johnson
  • Home Page: http://corndogcomputers.github.io/python-dio
  • Download URL: https://github.com/corndogcomputers/python-dio/tarball/master
  • Keywords: digitalocean,backup,vps,rsync,api
  • License:
    The MIT License (MIT)
    
    Copyright (c) 2014 Rob Johnson
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
  • Package Index Owner: corndogcomputers
  • DOAP record: dio-0.2.9.xml