The Python lib for digital ocean automation
Project description
pydoautomator
The Digital Ocean python automation lib
Alpha
Simple as that
from pydoautomator import Automator, Droplet
digital_ocean_token = 'my-digital-ocean-api-token'
aut = Automator(digital_ocean_token)
droplet_data = {
"name" : "t1.techno24x7.com",
"region" : "nyc1",
"size" : "s-8vcpu-16gb",
"image" : 68259296, # snapshot id
"ssh_keys" : [27410347, 27608055, 27590881],
"private_networking" : True,
"vpc_uuid" : "47e5c00a-2b23-4dac-bed4-0e44659941f3",
"monitoring" : True
}
droplet = Droplet(**droplet_data)
aut.create_droplet_from_snapshot(droplet)
Assign floating ip to droplet
droplet_id = 152412424
floating_ip = '164.90.252.72'
action_status = aut.assign_floating_ip_to_droplet(floating_ip, droplet_id)
if action_status == 'completed':
print('floating_ip assigned to droplet!')
Create droplet and assign floating ip as soon as droplet created
igital_ocean_token = 'my-super-cool-digital-ocean-api-token'
aut = Automator(digital_ocean_token)
droplet_data = {
"name": "t1.techno24x7.com",
"region": "nyc1",
"size": "s-8vcpu-16gb",
"image": 70649304, # snapshot id
"ssh_keys": [27410347, 27608055, 27590881],
"private_networking": True,
"vpc_uuid": "47e5c00a-2b23-4dac-bed4-0e44659941f3",
"monitoring": True
}
droplet = Droplet(**droplet_data)
droplet_id = aut.create_droplet_from_snapshot(droplet)
floating_ip = '164.90.252.72'
action_status = aut.assign_floating_ip_to_droplet(floating_ip, droplet_id)
if action_status == 'completed':
print('floating_ip assigned to droplet!')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydoautomator-0.5.0.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for pydoautomator-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87b4c30b8ca221c81c37aa7d68ad7d9223aa98e65188037ee0645e8d259d3d53 |
|
MD5 | 3cb96d49b0a0d0c843937e041728d2fc |
|
BLAKE2b-256 | c5bdb65621bcd360c1937733bf3e24c0c7512badca9cfd4d1fec5bc793ebb5e4 |