aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2023-11-07 23:19:07 +0100
committerDaniel Schadt <kingdread@gmx.de>2023-11-07 23:19:07 +0100
commita6b724b2f52923171b829a7a2c9f5902857f8fbf (patch)
treee788321b9476a5dd3908b00d677dc56dcf9e1bed
parenta9d5275bac96e55a4f5381b229163ff9f2770586 (diff)
downloadfietsboek-a6b724b2f52923171b829a7a2c9f5902857f8fbf.tar.gz
fietsboek-a6b724b2f52923171b829a7a2c9f5902857f8fbf.tar.bz2
fietsboek-a6b724b2f52923171b829a7a2c9f5902857f8fbf.zip
fix lint
-rw-r--r--fietsboek/data.py3
-rw-r--r--fietsboek/views/tileproxy.py5
2 files changed, 7 insertions, 1 deletions
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))