Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

cssnr/vultr-python

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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...

About

Python 3 wrapper for the Vultr API v2

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.