diff --git a/pyflowery/exceptions.py b/pyflowery/exceptions.py index b1c2ed0..20d9f96 100644 --- a/pyflowery/exceptions.py +++ b/pyflowery/exceptions.py @@ -1,19 +1,19 @@ class InternalServerError(Exception): + """Raised when the API returns a 5xx status code""" def __init__(self, message): self.message = message - super(InternalServerError, self).__init__(message) class ClientError(Exception): + """Raised when the API returns a 4xx status code""" def __init__(self, message): self.message = message - super(ClientError, self).__init__(message) class TooManyRequests(Exception): + """Raised when the API returns a 429 status code""" def __init__(self, message): self.message = message - super(TooManyRequests, self).__init__(message) class RetryLimitExceeded(Exception): + """Raised when the retry limit is exceeded""" def __init__(self, message): self.message = message - super(RetryLimitExceeded, self).__init__(message) diff --git a/pyflowery/rest_adapter.py b/pyflowery/rest_adapter.py index ab9fe71..ed8239a 100644 --- a/pyflowery/rest_adapter.py +++ b/pyflowery/rest_adapter.py @@ -64,12 +64,10 @@ class RestAdapter: try: if result.status_code == 429: raise TooManyRequests(f"{result.message} - {result.data}") - elif 400 <= result.status_code < 500: + if 400 <= result.status_code < 500: raise ClientError(f"{result.status_code} - {result.message} - {result.data}") - elif 500 <= result.status_code < 600: + if 500 <= result.status_code < 600: raise InternalServerError(f"{result.status_code} - {result.message} - {result.data}") - else: - pass except (TooManyRequests, InternalServerError) as e: if retry_counter < self.config.retry_limit: interval = self.config.interval * retry_counter diff --git a/pyflowery/version.py b/pyflowery/version.py index 2f2e521..c02d846 100644 --- a/pyflowery/version.py +++ b/pyflowery/version.py @@ -1 +1 @@ -VERSION = "1.0.3" +VERSION = "1.0.4" diff --git a/pyproject.toml b/pyproject.toml index 730225a..7877f09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pyflowery" -version = "1.0.3" +version = "1.0.4" description = "A Python API wrapper for the Flowery API" authors = ["cswimr "] license = "GPL 3.0-only"