From 19aeea4ffe23ddaadf5ea31d9085f1cb728f6c52 Mon Sep 17 00:00:00 2001 From: Matt Mullen Date: Thu, 9 Nov 2023 16:04:05 -0500 Subject: [PATCH 1/2] fix: Add API not enabled error --- sophosfirewall_python/firewallapi.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sophosfirewall_python/firewallapi.py b/sophosfirewall_python/firewallapi.py index 98198e1..fb7fee9 100644 --- a/sophosfirewall_python/firewallapi.py +++ b/sophosfirewall_python/firewallapi.py @@ -110,7 +110,12 @@ def _post(self, xmldata: str) -> requests.Response: resp_dict = xmltodict.parse(resp.content.decode())['Response'] if "Status" in resp_dict: if resp_dict["Status"]["@code"] == "534": - raise SophosFirewallAPIError("API operations are not allowed from the requester IP address") + # IP not allowed in API Access List + raise SophosFirewallAPIError(resp_dict["Status"]["#text"]) + + if resp_dict["Status"]["@code"] == "532": + # API access not enabled + raise SophosFirewallAPIError(resp_dict["Status"]["#text"]) if "Login" in resp_dict: if resp_dict["Login"]["status"] == "Authentication Failure": From c4f108af8d007659da5cee358bad2a5d6e463917 Mon Sep 17 00:00:00 2001 From: Matt Mullen Date: Thu, 9 Nov 2023 16:05:32 -0500 Subject: [PATCH 2/2] version: update to v0.1.13 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 874b9d6..786aed7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "sophosfirewall-python" -version = "0.1.12" +version = "0.1.13" description = "Python SDK for Sophos Firewall" authors = ["Matt Mullen "] readme = "README.md"