Skip to main content

Python 3 wrapper for the Vultr API v2.0

Project description

Discord Codacy Badge PyPI

Vultr Python

Python 3 wrapper for the Vultr API v2.

This is currently a WIP and not complete, but has some useful functions. Feel free to request additional functions and more on Discord.

Install

From PyPi using pip:

python -m pip install vultr-python

From Source using setuptools:

git clone https://github.com/cssnr/vultr-python.git
cd vultr-python
python setup.py install

Usage

You will need to create an api key and whitelist your IP address. Most functions do not work without an API Key.

Initialize the class with your API Key or with the VULTR_API_KEY environment variable.

from vultr import Vultr

vultr = Vultr('VULTR_API_KEY')

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('key-name', '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 all functions at the Doc site: https://vultr-python.sapps.me

View the full API documentation at Vultr: https://www.vultr.com/api

If you have more questions, concerns, or comments? Join our Discord for more information...

Project details


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.5.tar.gz (3.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page