Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahacek committed Dec 21, 2023
2 parents bea15bf + 244b230 commit 7d01ee3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog


## [0.1.2] 2023-12-21

### Breaking Change

* Updated `ApiPayloadError` exception to trigger when API returns HTTP 400+.

## [0.1.1] 2023-12-21

### Breaking Change
Expand Down
2 changes: 1 addition & 1 deletion pyonms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.. include:: ../README.md
"""

__version__ = "0.1.1"
__version__ = "0.1.2"

from multiprocessing import current_process
from urllib.parse import urlsplit
Expand Down
10 changes: 5 additions & 5 deletions pyonms/dao/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _get(
return response.json()
elif response.status_code == 401:
raise AuthenticationError
elif response.status_code >= 500:
elif response.status_code >= 400:
raise ApiPayloadError(message=response.text)
return {}

Expand Down Expand Up @@ -144,7 +144,7 @@ def _get_v1(
else:
xml_data = pyonms.utils.convert_xml(response.text)
return self._convert_v1_to_v2(endpoint, xml_data)
elif response.status_code >= 500:
elif response.status_code >= 400:
raise ApiPayloadError(message=response.text)
return {}

Expand Down Expand Up @@ -188,7 +188,7 @@ def _post(
verify=self.verify_ssl,
timeout=self.timeout,
)
if response.status_code >= 500:
if response.status_code >= 400:
raise ApiPayloadError(message=response.text)
return response

Expand Down Expand Up @@ -233,7 +233,7 @@ def _put(
verify=self.verify_ssl,
timeout=self.timeout,
)
if response.status_code >= 500:
if response.status_code >= 400:
raise ApiPayloadError(message=response.text)
return response

Expand Down Expand Up @@ -267,6 +267,6 @@ def _delete(self, url: str, headers: dict = None, params: dict = None) -> dict:
verify=self.verify_ssl,
timeout=self.timeout,
)
if response.status_code >= 500:
if response.status_code >= 400:
raise ApiPayloadError(message=response.text)
return {}

0 comments on commit 7d01ee3

Please sign in to comment.