From a6b724b2f52923171b829a7a2c9f5902857f8fbf Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Tue, 7 Nov 2023 23:19:07 +0100 Subject: fix lint --- fietsboek/data.py | 3 +++ fietsboek/views/tileproxy.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fietsboek/data.py b/fietsboek/data.py index 72d607a..5dab9bc 100644 --- a/fietsboek/data.py +++ b/fietsboek/data.py @@ -3,6 +3,9 @@ Data are objects that belong to a track (such as images), but are not stored in the database itself. This module makes access to such data objects easier. """ +# We don't have onexc yet in all supported versions, so let's ignore the +# deprecation for now and stick with onerror: +# pylint: disable=deprecated-argument import datetime import logging import os diff --git a/fietsboek/views/tileproxy.py b/fietsboek/views/tileproxy.py index 44ae808..999b04f 100644 --- a/fietsboek/views/tileproxy.py +++ b/fietsboek/views/tileproxy.py @@ -353,7 +353,10 @@ def tile_proxy(request): raise HTTPGatewayTimeout(f"No response in time from {provider}") from None except requests.HTTPError as exc: LOGGER.info("Proxy request failed for %s: %s", provider, exc) - return Response(f"Failed to get tile from {provider}", status_code=exc.response.status_code) + status_code = 400 + if exc.response: + status_code = exc.response.status_code + return Response(f"Failed to get tile from {provider}", status_code=status_code) else: request.redis.set(cache_key, resp.content, ex=TTL) return Response(resp.content, content_type=resp.headers.get("Content-type", content_type)) -- cgit v1.2.3