Not Logged In

poseidon 0.2.0

The DigitalOcean API allows you to manage Droplets and resources within the
DigitalOcean cloud in a simple, programmatic way using conventional HTTP
requests. The endpoints are intuitive and powerful, allowing you to easily make
calls to retrieve information or to execute actions.

All of the functionality that you are familiar with in the DigitalOcean control
panel is also available through the API, allowing you to script the complex
actions that your situation requires.

This library starts with a python wrapper for the API and aims to build tools to
make it easier to manage, provision, and deploy to Digital Ocean.

Setup

pip install -U poseidon

To run the unit tests make sure you have the ‘pytest’ module.
If not, run

pip install -U pytest

Examples

Setup authentication by generating an API key and exporting it as the value of the
“DIGITALOCEAN_API_KEY” environment variable:

Domains

# list domainsclient.domains.list()# it works# create new domainip_address='127.0.0.1'test='b7qtKVSdqoVZ2bCX0SXdn2pxZitnFjUx.com'# must be uniquedomain=client.domains.create(test,ip_address)printdomain['name']# retrieve a domain by namenew_domain=client.domains.get(domain['name'])# delete a domain by nameclient.domains.delete(new_domain['name'])

Regions

client.regions.list()

Sizes

client.sizes.list()

Testing

pip install -U pytest
py.test

Because the test for droplets goes through the exercise of creating a new droplet,
modifying it, then finally destroying it, the test takes a long time to run.
To only run the other tests, use the “not slow” marker from “pytest”: