diff --git a/proxmoxer/backends/https.py b/proxmoxer/backends/https.py index ad76a47..e96b822 100644 --- a/proxmoxer/backends/https.py +++ b/proxmoxer/backends/https.py @@ -38,9 +38,10 @@ def __repr__(self): class ProxmoxHTTPAuth(AuthBase): - def __init__(self, base_url, username, password, verify_ssl=False): + def __init__(self, base_url, username, password, verify_ssl=False, timeout=5): response_data = requests.post(base_url + "/access/ticket", verify=verify_ssl, + timeout=timeout, data={"username": username, "password": password}).json()["data"] if response_data is None: raise AuthenticationError("Couldn't authenticate user: {0} to {1}".format(username, base_url + "/access/ticket")) @@ -122,7 +123,7 @@ def __init__(self, host, user, password, port=8006, verify_ssl=True, if auth_token is not None: self.auth = ProxmoxHTTPTokenAuth(auth_token, csrf_token) else: - self.auth = ProxmoxHTTPAuth(self.base_url, user, password, verify_ssl) + self.auth = ProxmoxHTTPAuth(self.base_url, user, password, verify_ssl, timeout) self.verify_ssl = verify_ssl self.mode = mode self.timeout = timeout