Git Product home page Git Product logo

dopy's Introduction

Digital Ocean API Python Wrapper

Inspired by [dop](https://github.com/ahmontero/dop).

Installation

# pip install dopy

Getting Started

To interact with Digital Ocean, you first need .. a digital ocean account with valid API keys.

Keys can be set either as Env variables, or within the code.

For API v.2.

# export DO_API_VERSION='2'
# export DO_API_TOKEN='api_token'
>>> from dopy.manager import DoManager
>>> do = DoManager(None, 'api_token', api_version=2)

For API v.1.

# export DO_CLIENT_ID='client_id'
# export DO_API_KEY='long_api_key'
>>> from dopy.manager import DoManager
>>> do = DoManager('client_id', 'long_api_key')

Methods

The methods of the DoManager are self explanatory; ex.

>>> do.all_active_droplets()
>>> do.show_droplet('12345')
>>> do.destroy_droplet('12345')
>>> do.all_regions()
>>> do.all_images()
>>> do.all_ssh_keys()
>>> do.sizes()
>>> do.all_domains()
>>> do.new_droplet('new_droplet', 66, 1601, 1)

The methods for v.2 API are similar, the only difference is using names instead of IDs for domains and slugs for sizes, images and datacenters; ex.

>>> do.show_domain('exapmle.com')
>>> do.new_droplet('new_droplet', '512mb', 'lamp', 'ams2')

Methods for Floating IPs are:

>>> do.all_floating_ips()
>>> do.new_floating_ip(droplet_id, region)
>>> do.destroy_floating_ip(ip_addr)
>>> do.assign_floating_ip(ip_addr)
>>> do.unassign_floating_ip(ip_addr)
>>> do.list_floating_ip_actions(ip_addr)
>>> do.get_floating_ip_action(ip_addr, action_id)

TODO

See github issue list - post if any needed

https://github.com/devo-ps/dopy/issues

dopy's People

Contributors

atjones0011 avatar cooperaj avatar cvallance avatar dave08 avatar jkassemi avatar mbugeia avatar neomantra avatar polyrabbit avatar regentgal avatar rgbkrk avatar sunsongxp avatar whiskybar avatar xowap avatar zbal avatar zimbatm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.