From 2c02e9db42e3f22834c74e168144c5d50e0ad3e9 Mon Sep 17 00:00:00 2001 From: khamaileon Date: Sat, 15 Jul 2023 23:03:15 +0200 Subject: [PATCH] fix: content-type issue --- routingpy/client_default.py | 11 ++++------- routingpy/exceptions.py | 6 ------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/routingpy/client_default.py b/routingpy/client_default.py index 1aa20c5..b2cbba3 100644 --- a/routingpy/client_default.py +++ b/routingpy/client_default.py @@ -229,7 +229,10 @@ def _get_body(response): content_type = response.headers["content-type"] if status_code == 200: - if content_type in ["application/json", "application/x-www-form-urlencoded"]: + if content_type == "image/tiff": + return response.content + + else: try: return response.json() @@ -238,12 +241,6 @@ def _get_body(response): "Can't decode JSON response:{}".format(response.text) ) - elif content_type == "image/tiff": - return response.content - - else: - raise exceptions.UnsupportedContentType(status_code, response.text) - if status_code == 429: raise exceptions.OverQueryLimit(status_code, response.text) diff --git a/routingpy/exceptions.py b/routingpy/exceptions.py index 3200831..291d8ea 100644 --- a/routingpy/exceptions.py +++ b/routingpy/exceptions.py @@ -71,9 +71,3 @@ class OverQueryLimit(RouterError, RetriableRequest): """ pass - - -class UnsupportedContentType(Exception): # pragma: no cover - """The response has an unsupported content type.""" - - pass