Use requests client for Proxmox password auth

This commit is contained in:
2026-07-20 13:42:01 +02:00
parent 398b9dec99
commit 7d8819c374
3 changed files with 11 additions and 3 deletions
+9 -1
View File
@@ -291,7 +291,7 @@ class ProxmoxClient:
if "@" not in self.endpoint.username:
raise ProxmoxConnectionError("Proxmox username must include a realm, e.g. root@pam or user@pve.")
if ProxmoxSDK is not None:
if self._should_use_sdk():
self._connect_with_sdk()
return self
@@ -327,6 +327,14 @@ class ProxmoxClient:
return f"[{host}]"
return host
def _should_use_sdk(self):
# proxmox-sdk 0.0.12 builds password ticket URLs without /api2/json.
# Keep it for stateless API-token auth, where no ticket endpoint is used.
return (
ProxmoxSDK is not None
and self.endpoint.auth_method == EndpointAuthMethodChoices.METHOD_API_TOKEN
)
def _connect_with_sdk(self):
user = (self.endpoint.username or "").strip()
kwargs = {