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.
Installing
From PyPi:
python -m pip install vultr-python
From Source:
git clone https://github.com/cssnr/vultr-python.git
cd vultr-python
python -m pip install -U .
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('APIKEY')
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)
Browse all available functions in the vultr.py file.
View the full documentation here: https://www.vultr.com/api
Get support, request improvements, report bugs and much more on Discord.