[PR #46] [MERGED] ResourceException now has status_code, status_message, content #151

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/46
Author: @mihailstoynov
Created: 1/29/2021
Status: Merged
Merged: 2/10/2021
Merged by: @jhollowe

Base: developHead: more-expressive-resource-exception


📝 Commits (3)

  • b9510dd allow passing values containg spaces and special characters when using ssh
  • 89999a8 Add errors to ResourceException; use response text
  • 9d4219f Fix missing text attribute in SSH backends

📊 Changes

2 files changed (+28 additions, -8 deletions)

View changed files

📝 proxmoxer/backends/base_ssh.py (+1 -0)
📝 proxmoxer/core.py (+27 -8)

📄 Description

ResourceException now has status_code, status_message, content fields that help when processing errors.

Very useful when you just want to test just the response code of the request like this:

    retries = 5
    while retries:
        try:
            return request_orig(*args, **kwargs)
        except ResourceException as e:
            if e.status_code == 500 and re.match("command '.*?' failed: got timeout", e.reason):
                retries -= 1
            else:
                raise


🔄 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/46 **Author:** [@mihailstoynov](https://github.com/mihailstoynov) **Created:** 1/29/2021 **Status:** ✅ Merged **Merged:** 2/10/2021 **Merged by:** [@jhollowe](https://github.com/jhollowe) **Base:** `develop` ← **Head:** `more-expressive-resource-exception` --- ### 📝 Commits (3) - [`b9510dd`](https://github.com/proxmoxer/proxmoxer/commit/b9510dd984b8299d8ed5365d1bb8797db137e354) allow passing values containg spaces and special characters when using ssh - [`89999a8`](https://github.com/proxmoxer/proxmoxer/commit/89999a897a039f102bc87e4151e2e56bb9d79796) Add errors to ResourceException; use response text - [`9d4219f`](https://github.com/proxmoxer/proxmoxer/commit/9d4219f155770b071dcf8b70afe33e5fa2b291e6) Fix missing text attribute in SSH backends ### 📊 Changes **2 files changed** (+28 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `proxmoxer/backends/base_ssh.py` (+1 -0) 📝 `proxmoxer/core.py` (+27 -8) </details> ### 📄 Description ResourceException now has status_code, status_message, content fields that help when processing errors. Very useful when you just want to test just the response code of the request like this: ``` retries = 5 while retries: try: return request_orig(*args, **kwargs) except ResourceException as e: if e.status_code == 500 and re.match("command '.*?' failed: got timeout", e.reason): retries -= 1 else: raise ``` --- <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#151
No description provided.