[GH-ISSUE #202] Connecting to PBS with wrong password shields JSONDecodeError #115

Open
opened 2026-02-27 15:46:31 +03:00 by kerem · 0 comments
Owner

Originally created by @abbbi on GitHub (Mar 1, 2025).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/202

hi,

thanks for this project.

It seems connecting to PBS with an wrong password shields an JSONDecodeError:

 python3 test.py
Traceback (most recent call last):
  File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/requests/models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/abi/pbsav/test.py", line 2, in <module>
    proxmox = ProxmoxAPI(
              ^^^^^^^^^^^
  File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/proxmoxer/core.py", line 208, in __init__
    self._backend = importlib.import_module(f".backends.{backend}", "proxmoxer").Backend(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/proxmoxer/backends/https.py", line 310, in __init__
    self.auth = ProxmoxHTTPAuth(
                ^^^^^^^^^^^^^^^^
  File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/proxmoxer/backends/https.py", line 63, in __init__
    self._get_new_tokens(password=password, otp=otp)
  File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/proxmoxer/backends/https.py", line 80, in _get_new_tokens
    ).json()["data"]
      ^^^^^^
  File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/requests/models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

cat test.py
from proxmoxer import ProxmoxAPI
proxmox = ProxmoxAPI(
    "192.168.161.241",
    user="root@pam",
    password="foo",
    verify_ssl=False,
    service="pbs",
)

pip3 list | grep proxmoxer
proxmoxer          2.2.0

Originally created by @abbbi on GitHub (Mar 1, 2025). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/202 hi, thanks for this project. It seems connecting to PBS with an wrong password shields an JSONDecodeError: ``` python3 test.py Traceback (most recent call last): File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/requests/models.py", line 974, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/json/__init__.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/abi/pbsav/test.py", line 2, in <module> proxmox = ProxmoxAPI( ^^^^^^^^^^^ File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/proxmoxer/core.py", line 208, in __init__ self._backend = importlib.import_module(f".backends.{backend}", "proxmoxer").Backend( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/proxmoxer/backends/https.py", line 310, in __init__ self.auth = ProxmoxHTTPAuth( ^^^^^^^^^^^^^^^^ File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/proxmoxer/backends/https.py", line 63, in __init__ self._get_new_tokens(password=password, otp=otp) File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/proxmoxer/backends/https.py", line 80, in _get_new_tokens ).json()["data"] ^^^^^^ File "/home/abi/pbsav/pbsavenv/lib/python3.11/site-packages/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ``` ``` cat test.py from proxmoxer import ProxmoxAPI proxmox = ProxmoxAPI( "192.168.161.241", user="root@pam", password="foo", verify_ssl=False, service="pbs", ) pip3 list | grep proxmoxer proxmoxer 2.2.0 ```
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#115
No description provided.