Docs: Aktualisierung der Dokumentation für Task [31e88f42]
This commit is contained in:
@@ -13,6 +13,10 @@ class ContactNotFoundException(Exception):
|
||||
"""Custom exception for 404 errors on Contact/Person lookups."""
|
||||
pass
|
||||
|
||||
class SuperOfficeAuthenticationError(Exception):
|
||||
"""Custom exception for auth/token refresh failures."""
|
||||
pass
|
||||
|
||||
class SuperOfficeClient:
|
||||
"""A client for interacting with the SuperOffice REST API."""
|
||||
|
||||
@@ -86,7 +90,7 @@ class SuperOfficeClient:
|
||||
"""Helper to handle 401 Unauthorized with auto-refresh."""
|
||||
if not self.access_token:
|
||||
if not self._refresh_access_token():
|
||||
return None
|
||||
raise SuperOfficeAuthenticationError("FATAL: Could not get initial access token.")
|
||||
|
||||
url = f"{self.base_url}/{endpoint}"
|
||||
try:
|
||||
@@ -113,7 +117,7 @@ class SuperOfficeClient:
|
||||
return self._request_with_retry(method, endpoint, payload, retry=False)
|
||||
else:
|
||||
logger.error("❌ Token Refresh failed during retry.")
|
||||
return None
|
||||
raise SuperOfficeAuthenticationError("Could not refresh token during retry.")
|
||||
|
||||
if resp.status_code == 204:
|
||||
return True
|
||||
@@ -128,10 +132,10 @@ class SuperOfficeClient:
|
||||
raise ContactNotFoundException(f"Entity not found at {endpoint}") from e
|
||||
|
||||
logger.error(f"❌ API {method} Error for {endpoint} (Status: {e.response.status_code}): {e.response.text}")
|
||||
return None
|
||||
raise # Re-raise the original HTTPError
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Connection Error during {method} for {endpoint}: {e}")
|
||||
return None
|
||||
raise # Re-raise other exceptions
|
||||
|
||||
def _get(self, endpoint):
|
||||
return self._request_with_retry("GET", endpoint)
|
||||
|
||||
Reference in New Issue
Block a user