[PR #57] [MERGED] Allow responses which are not JSON to be handled #155

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

📋 Pull Request Information

Original PR: https://github.com/proxmoxer/proxmoxer/pull/57
Author: @jhollowe
Created: 5/22/2021
Status: Merged
Merged: 5/31/2021
Merged by: @jhollowe

Base: developHead: handle-non-json


📝 Commits (4)

  • 3a7462b Allow responses which are not JSON to be handled
  • cae2c10 Support older versions of json module
  • fdf7e2a Use ValueError to maintain old compatibility
  • ebefff4 Merge branch 'develop' into handle-non-json

📊 Changes

3 files changed (+10 additions, -18 deletions)

View changed files

📝 proxmoxer/backends/base_ssh.py (+2 -2)
📝 proxmoxer/backends/https.py (+1 -1)
📝 proxmoxer/core.py (+7 -15)

📄 Description

Rather than raising a JSONDecodeError, a ResourceException will be raised with the raw response text as the error.

If the return code is a 2xx code, it will return a dictionary with the text under the key "errors" (e.g. {"errors": "this was a non-JSON response"}). While this key name does not exactly describe the contents, it makes the raising of the ResourceException possible and a "successful" API call that does not actually return JSON is (in my opinion) an error.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/proxmoxer/proxmoxer/pull/57 **Author:** [@jhollowe](https://github.com/jhollowe) **Created:** 5/22/2021 **Status:** ✅ Merged **Merged:** 5/31/2021 **Merged by:** [@jhollowe](https://github.com/jhollowe) **Base:** `develop` ← **Head:** `handle-non-json` --- ### 📝 Commits (4) - [`3a7462b`](https://github.com/proxmoxer/proxmoxer/commit/3a7462b82dbc6ca07f550f791c56659eeb3b2d57) Allow responses which are not JSON to be handled - [`cae2c10`](https://github.com/proxmoxer/proxmoxer/commit/cae2c104c31e295f8f5ec8b42c686320b4bf1363) Support older versions of json module - [`fdf7e2a`](https://github.com/proxmoxer/proxmoxer/commit/fdf7e2a78f88a747c98d139732df9f75d1cd73c5) Use ValueError to maintain old compatibility - [`ebefff4`](https://github.com/proxmoxer/proxmoxer/commit/ebefff4099e7efa07f3080b392200878a0da3be6) Merge branch 'develop' into handle-non-json ### 📊 Changes **3 files changed** (+10 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `proxmoxer/backends/base_ssh.py` (+2 -2) 📝 `proxmoxer/backends/https.py` (+1 -1) 📝 `proxmoxer/core.py` (+7 -15) </details> ### 📄 Description Rather than raising a JSONDecodeError, a ResourceException will be raised with the raw response text as the error. If the return code is a 2xx code, it will return a dictionary with the text under the key "errors" (e.g. `{"errors": "this was a non-JSON response"}`). While this key name does not exactly describe the contents, it makes the raising of the ResourceException possible and a "successful" API call that does not actually return JSON is (in my opinion) an error. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 15:46:42 +03:00
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#155
No description provided.