From 9c286edf477d3d3776d7de4883e46d9c5e496344 Mon Sep 17 00:00:00 2001 From: NeonKirill <74428618+NeonKirill@users.noreply.github.com> Date: Wed, 11 Dec 2024 20:54:07 +0100 Subject: [PATCH] Updated status code exclusion in observer to 401 (#114) --- services/klatchat_observer/controller.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/klatchat_observer/controller.py b/services/klatchat_observer/controller.py index d461eaa2..cfeb57a2 100644 --- a/services/klatchat_observer/controller.py +++ b/services/klatchat_observer/controller.py @@ -25,6 +25,7 @@ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import http import json import re import time @@ -829,7 +830,7 @@ def _fetch_klat_server(self, url: str) -> Response: response = self._send_get_request_to_klat(url=url) if response.ok: return response - elif response.status_code != 403: + elif response.status_code != http.HTTPStatus.UNAUTHORIZED.value: raise KlatAPIAuthorizationError("Klat API unavailable") self._login_to_klat_server() return self._send_get_request_to_klat(url=url)