Python 3 wrapper for the Vultr API v2.0
Project description
Vultr Python
Python wrapper for the Vultr API.
This is currently a WIP and not complete, but has some functions. Feel free to request additional functions in Discord.
Examples
You will need to create a token and whitelist your IP address. Most functions do not work without an API Token.
Initialize the class with your API Token
from vultr import Vultr
vultr = Vultr('XXXXXXXXXX')
List plans and get available regions for that plan
plans = vultr.list_plans()
plan = plans[0] # 0 seems to be the basic 5 dollar plan
regions = vultr.list_regions()
available = vultr.filter_regions(regions, plan['locations'])
Get the OS list and filter by name
os_list = vultr.list_os()
ubuntu_lts = vultr.filter_os(os_list, 'Ubuntu 20.04 x64')
Create a new ssh key from key string
sshkey = vultr.create_key('shane-secure-102916', 'ssh-rsa AAAA...')
Create a new instance
hostname = 'my-new-host'
data = {
'region': available[0]['id'],
'plan': plan['id'],
'os_id': ubuntu_lts['id'],
'sshkey_id': sshkey['id'],
'hostname': hostname,
'label': hostname,
}
instance = vultr.create_instance(**data)
View the full documentation here: https://www.vultr.com/api
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
vultr-python-0.1.3.tar.gz
(3.5 kB
view hashes)