mirror of
https://github.com/proxmoxer/proxmoxer.git
synced 2026-04-25 23:26:00 +03:00
[PR #57] [MERGED] Allow responses which are not JSON to be handled #155
Labels
No labels
backend:https
backend:local
backend:openssh
backend:ssh_paramiko
pull-request
status:ansible-issue
status:help-wanted
status:info-needed
status:proxmox-issue
status:review-needed
type:bug 🐞
type:dependency ⛓️
type:docs 📝
type:enhancement ⏫
type:maintenance 🛠️
type:meta
type:question ❓
type:request ✋
type:testing 🧪
version:1.x
version:latest
version:py2
version:py3
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/proxmoxer#155
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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:
develop← Head:handle-non-json📝 Commits (4)
3a7462bAllow responses which are not JSON to be handledcae2c10Support older versions of json modulefdf7e2aUse ValueError to maintain old compatibilityebefff4Merge 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.