Proxmoxer is a python wrapper around the Proxmox REST API v2. It currently supports the Proxmox services of Proxmox Virtual Environment (PVE), Proxmox Mail Gateway (PMG), and Proxmox Backup Server (PBS).
It was inspired by slumber, but it is dedicated only to Proxmox. It allows not only REST API use over HTTPS, but the same api over ssh and pvesh utility.
Like Proxmoxia, it dynamically creates attributes which responds to the attributes you've attempted to reach.
Full Documentation is available at https://proxmoxer.github.io/docs/
Full instructions for the minimal steps needed to update to version 2 can be found in Migration Docs.
pip install proxmoxer
To use the 'https' backend, install requests
pip install requests
To use the 'ssh_paramiko' backend, install paramiko
pip install paramiko
To use the 'openssh' backend, install openssh_wrapper
pip install openssh_wrapper
The first thing to do is import the proxmoxer library and create ProxmoxAPI instance.
from proxmoxer import ProxmoxAPI
proxmox = ProxmoxAPI(
"proxmox_host", user="admin@pam", password="secret_word", verify_ssl=False
)
This will connect by default to PVE through the 'https' backend.
Note: ensure you have the required libraries (listed above) for the connection method you are using
Queries are exposed via the access methods get, post, put and delete. For convenience two synonyms are available: create for post, and set for put.
Using the paths from the PVE API v2, you can create API calls using the access methods above.
>>> for node in proxmox.nodes.get():
... for vm in proxmox.nodes(node["node"]).qemu.get():
... print(f"{vm['vmid']}. {vm['name']} => {vm['status']}")
...
141. puppet-2.london.example.com => running
101. munki.london.example.com => running
102. redmine.london.example.com => running
140. dns-1.london.example.com => running
126. ns-3.london.example.com => running
113. rabbitmq.london.example.com => running