Skip to content
/ dolib Public

Python library for awesome Digital Ocean API

License

Notifications You must be signed in to change notification settings

geraxe/dolib

Repository files navigation

Python Digital Ocean Library

PyPI version Supported Python Versions Tests Coverage

Description

DOLib is a fully featured python 3.6+ library for Digital Ocean, which provides sync and async APIs. This library supports all Digital Ocean API methods and simple in use. Enjoy!

Documentation

Documentation in progress. You can see this Documentation

Requirements

Python 3.6+

DOLib uses these awesome libraries:

Installation

pip install dolib

Example

Sync client

from dolib import Client

client = Client(token="60c13d47f17dbed9f7293cf8c82d18fece3439a54f88e6c52c2df07f87bd8dd9")

droplets = client.droplets.all()
volume = client.volumes.get("53cf7120-9d5b-11ea-aed1-0a58ac14d008")

client.volumes.attach(volume, droplet_id=droplets[0].id)

Async client

from dolib import AsyncClient
from dolib.models import Droplet

async with Client(token="60c13d47f17dbed9f7293cf8c82d18fece3439a54f88e6c52c2df07f87bd8dd9") as client:
    droplet = Droplet(name="dolib-droplet", region="fra1", size="s-1vcpu-1gb", image="ubuntu-18-04-x64")
    droplet = await client.droplets.create(droplet)

Contributing

To run the tests:

tox -p all

Versioning

This project follows Semantic Versioning 2.0.0.

License

This project is licensed under the terms of the MIT license.