proxmoxer icon indicating copy to clipboard operation
proxmoxer copied to clipboard

Add support for resources with dashes in name

Open julozi opened this issue 4 years ago • 2 comments

Proxmox API includes a few resources with dashes (-) in their name (like /api2/json/nodes/{node}/qemu/{vmid}/agent/get-host-name). However the dash character (-) is not authorized in Python object attributes.

This PR adds support for this kind of resource's name by replacing dashes by underscores.

Exemple code :

client.nodes('my_node').qemu(12).agent.get_host_name.get()

will call the API URL : /api2/json/nodes/my_node/qemu/12/agent/get-host-name

julozi avatar Jul 31 '19 16:07 julozi

Coverage Status

Coverage increased (+0.07%) to 79.208% when pulling de51882cf5717195f0f42152ead471360fc708ce on julozi:support_dash_resources into f7874b53ebd7e06de1396b200d6a6020d696c984 on swayf:develop.

coveralls avatar Jul 31 '19 16:07 coveralls

@julozi Would you mind re-creating this PR for https://github.com/proxmoxer/proxmoxer ?

morph027 avatar Dec 28 '19 16:12 morph027