[GH-ISSUE #215] Unable to Set Multiple DHCP Ranges for a Subnet via Proxmoxer #119

Closed
opened 2026-02-27 15:46:32 +03:00 by kerem · 2 comments
Owner

Originally created by @sstock2005 on GitHub (Jan 9, 2026).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/215

Unable to Set Multiple DHCP Ranges for a Subnet via Proxmoxer

Hello! I'm running into an issue trying to configure multiple DHCP ranges for a subnet using the Proxmoxer library.

The Problem

According to the Proxmox REST API, the dhcp-range parameter can be repeated in a single request to define multiple ranges. For example, the API expects something like:

dhcp-range=start-address=192.168.100.10,end-address=192.168.100.55
dhcp-range=start-address=192.168.100.105,end-address=192.168.100.150

From what I've read Python dictionaries (and therefore **kwargs) do not allow duplicate keys. As a result, it seems impossible to send multiple dhcp-range parameters in a single call through Proxmoxer.


What I've Tried

from proxmoxer import ProxmoxAPI

host = "localhost"
user = "root@pam"
password = "..."

prox = ProxmoxAPI(host, user=user, password=password, verify_ssl=False)

dhcp_ranges = ["192.168.100.10,192.168.100.55", "192.168.100.105,192.168.100.150"]

for dhcp_range in dhcp_ranges:
    start, end = dhcp_range.split(",")
    dhcp_range_string = f"start-address={start},end-address={end}"

    data = {
        "subnet": "test-192.168.100.0-24",
        "dhcp-range": dhcp_range_string
    }

prox.cluster.sdn.vnets("test").subnets("test-192.168.100.0-24").put(**data)

This only allows setting a single DHCP range because the dictionary cannot contain duplicate dhcp-range keys. I tried to use tuples and index keys but the REST API returns a schema error.

Expected Behavior

I would like to be able to set multiple DHCP ranges for a subnet in a single API call using Proxmoxer, in the same way the REST API supports repeated dhcp-range parameters.

Question

Is there a supported way in Proxmoxer to send repeated parameters like dhcp-range? Or is this a limitation of the library?

Any guidance or workarounds would be greatly appreciated!

Originally created by @sstock2005 on GitHub (Jan 9, 2026). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/215 # Unable to Set Multiple DHCP Ranges for a Subnet via Proxmoxer Hello! I'm running into an issue trying to configure multiple DHCP ranges for a subnet using the Proxmoxer library. ## The Problem According to the Proxmox REST API, the `dhcp-range` parameter can be repeated in a single request to define multiple ranges. For example, the API expects something like: ``` dhcp-range=start-address=192.168.100.10,end-address=192.168.100.55 dhcp-range=start-address=192.168.100.105,end-address=192.168.100.150 ``` From what I've read Python dictionaries (and therefore `**kwargs`) do not allow duplicate keys. As a result, it seems impossible to send multiple `dhcp-range` parameters in a single call through Proxmoxer. --- ## What I've Tried ```python from proxmoxer import ProxmoxAPI host = "localhost" user = "root@pam" password = "..." prox = ProxmoxAPI(host, user=user, password=password, verify_ssl=False) dhcp_ranges = ["192.168.100.10,192.168.100.55", "192.168.100.105,192.168.100.150"] for dhcp_range in dhcp_ranges: start, end = dhcp_range.split(",") dhcp_range_string = f"start-address={start},end-address={end}" data = { "subnet": "test-192.168.100.0-24", "dhcp-range": dhcp_range_string } prox.cluster.sdn.vnets("test").subnets("test-192.168.100.0-24").put(**data) ``` This only allows setting a single DHCP range because the dictionary cannot contain duplicate dhcp-range keys. I tried to use tuples and index keys but the REST API returns a schema error. ## Expected Behavior I would like to be able to set multiple DHCP ranges for a subnet in a single API call using Proxmoxer, in the same way the REST API supports repeated dhcp-range parameters. ## Question Is there a supported way in Proxmoxer to send repeated parameters like `dhcp-range`? Or is this a limitation of the library? Any guidance or workarounds would be greatly appreciated!
kerem closed this issue 2026-02-27 15:46:32 +03:00
Author
Owner

@morph027 commented on GitHub (Jan 9, 2026):

The API spec says it's of type array and description is A list of DHCP ranges for this subnet in format [pve-sdn-dhcp-range, ...]

So this might work (not tested):

data = {
    "subnet": "test-192.168.100.0-24",
    "dhcp-range": [
        "start-address=192.168.100.10,end-address=192.168.100.55",
        "start-address=192.168.100.105,end-address=192.168.100.150"
    ]
}
<!-- gh-comment-id:3730654426 --> @morph027 commented on GitHub (Jan 9, 2026): The API spec says it's of type `array` and description is *A list of DHCP ranges for this subnet* in format `[pve-sdn-dhcp-range, ...]` So this might work (not tested): ```python data = { "subnet": "test-192.168.100.0-24", "dhcp-range": [ "start-address=192.168.100.10,end-address=192.168.100.55", "start-address=192.168.100.105,end-address=192.168.100.150" ] } ```
Author
Owner

@sstock2005 commented on GitHub (Jan 21, 2026):

This works! Thank you!

The API spec says it's of type array and description is A list of DHCP ranges for this subnet in format [pve-sdn-dhcp-range, ...]

So this might work (not tested):

data = {
"subnet": "test-192.168.100.0-24",
"dhcp-range": [
"start-address=192.168.100.10,end-address=192.168.100.55",
"start-address=192.168.100.105,end-address=192.168.100.150"
]
}

<!-- gh-comment-id:3781415485 --> @sstock2005 commented on GitHub (Jan 21, 2026): This works! Thank you! > The API spec says it's of type `array` and description is _A list of DHCP ranges for this subnet_ in format `[pve-sdn-dhcp-range, ...]` > > So this might work (not tested): > > data = { > "subnet": "test-192.168.100.0-24", > "dhcp-range": [ > "start-address=192.168.100.10,end-address=192.168.100.55", > "start-address=192.168.100.105,end-address=192.168.100.150" > ] > }
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#119
No description provided.