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 details)

Uploaded Source

File details

Details for the file vultr-python-0.1.5.tar.gz.

File metadata

  • Download URL: vultr-python-0.1.5.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.5

File hashes

Hashes for vultr-python-0.1.5.tar.gz
Algorithm Hash digest
SHA256 aa0be825f2b0b5c8a4e2096e6001885616f08566ad069dd6ecff6efc7b7a89a1
MD5 216be63ec4bc6aaa6437a992326745d4
BLAKE2b-256 a655421b968e8c1bce6ba1c0e5c6b4c21bd170e85a07eac8c8409697e966893d

See more details on using hashes here.

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