proxmoxer Documentation

repository·develop·Indexed 21 days ago

https://github.com/proxmoxer/proxmoxer

A Python wrapper for the Proxmox REST API v2, supporting Proxmox Virtual Environment (PVE), Proxmox Mail Gateway (PMG), and Proxmox Backup Server (PBS). It provides connectivity via HTTPS, SSH, or the pvesh utility and allows API queries using dynamic attributes with get, post, put, and delete methods.

Tokens
453
Snippets
3
Records
3
Agent score
24%

What's inside proxmoxer

  1. Install proxmoxer and required backends

    develop

    Install the core library using pip:

    pip install proxmoxer

    Depending on the connection method you intend to use, you must install the corresponding backend library:

    • HTTPS backend: Requires requests.
    • ssh_paramiko backend: Requires paramiko.
    • openssh backend: Requires openssh_wrapper.
    pip install proxmoxer
    pip install requests
    pip install paramiko
    pip install openssh_wrapper
  2. Initialize a ProxmoxAPI instance

    develop

    To interact with Proxmox services (PVE, PMG, or PBS), import ProxmoxAPI and create an instance. By default, this connects to Proxmox Virtual Environment (PVE) using the https backend.

    from proxmoxer import ProxmoxAPI
    
    proxmox = ProxmoxAPI(
        "proxmox_host", user="admin@pam", password="secret_word", verify_ssl=False
    )
  3. Perform API queries with get, post, put, and delete

    develop

    Proxmoxer exposes API paths as dynamic attributes. You can execute queries using the following access methods:

    • get(): Retrieve data.
    • post() / create(): Create new resources.
    • put() / set(): Update existing resources.
    • delete(): Remove resources.

    Use the paths defined in the Proxmox REST API documentation to navigate the object tree.

    # Example: Iterating through nodes and listing QEMU VMs
    for node in proxmox.nodes.get():
        for vm in proxmox.nodes(node["node"]).qemu.get():
            print(f"{vm['vmid']}. {vm['name']} => {vm['status']}")