diff --git a/core/call_lookup_helper.py b/core/call_lookup_helper.py
index 93ee4fd..71a89d1 100644
--- a/core/call_lookup_helper.py
+++ b/core/call_lookup_helper.py
@@ -12,7 +12,7 @@ def get_call_info(callsign, lookup_credentials):
if callsign:
# Sort callsign providers by priority order, so we query the highest priority (lowest numbers) first, and only
# query other providers for data we are missing as we go along.
- for p in sorted(DATA_PROVIDERS.callsign_data_providers, key=lambda p: p.priority):
+ for p in sorted(DATA_PROVIDERS.callsign_data_providers, key=lambda p2: p2.priority):
if p.enabled:
# Get new lookup data
data = p.lookup(callsign, lookup_credentials)
diff --git a/core/data_providers.py b/core/data_providers.py
index 385723f..4d974b4 100644
--- a/core/data_providers.py
+++ b/core/data_providers.py
@@ -31,10 +31,10 @@ class DataProviders:
self.callsign_data_providers.append(create_provider_from_config("providers.callsigndata", entry))
@staticmethod
- def start_providers(providers, type):
+ def start_providers(providers, provider_type):
"""Helper method to activate enabled providers in the list."""
- logging.info(f"Starting %s providers...", type)
+ logging.info(f"Starting %s providers...", provider_type)
for p in providers:
if p.enabled:
p.start()
diff --git a/core/live_data_cache.py b/core/live_data_cache.py
index 935078b..16d0652 100644
--- a/core/live_data_cache.py
+++ b/core/live_data_cache.py
@@ -34,7 +34,7 @@ class LiveDataCache:
try:
callback(value)
except Exception:
- logging.error("Listener raised an exception for key %s", key, exc_info=True)
+ logging.exception("Listener raised an exception for key %s", key)
def get(self, key, default=None):
@@ -71,7 +71,7 @@ class LiveDataCache:
try:
self._disk_cache.set("snapshot", data)
except Exception as e:
- logging.error("Failed to write snapshot to %s", self._snapshot_dir, e, exc_info=True)
+ logging.exception("Failed to write snapshot to %s", self._snapshot_dir, e)
def _load_snapshot(self):
data = self._disk_cache.get("snapshot")
diff --git a/core/sig_lookup_helper.py b/core/sig_lookup_helper.py
index c3984c8..1d96cac 100644
--- a/core/sig_lookup_helper.py
+++ b/core/sig_lookup_helper.py
@@ -29,7 +29,7 @@ def get_sig_ref_info(sig, ref_id):
# If the SIG is HEMA, we have no current lookup for this so just skip the lookup here.
if sig.upper() == "HEMA":
- sig_ref.type = "Summit"
+ sig_ref.ref_type = "Summit"
return sig_ref
### PROGRAMMATIC DATA GENERATION INSTEAD OF LOOKUPS ###
@@ -38,7 +38,7 @@ def get_sig_ref_info(sig, ref_id):
# calculate all the information we are going to get directly.
if sig.upper() == "TILES":
# Tiles on the Air just uses Maidenhead 6-digit squares, so ID, Name and Grid are all the same
- sig_ref.type = "Grid"
+ sig_ref.ref_type = "Grid"
if not sig_ref.name:
sig_ref.name = sig_ref.id
if not sig_ref.grid:
@@ -50,7 +50,7 @@ def get_sig_ref_info(sig, ref_id):
return sig_ref
elif sig.upper() == "WAB" or sig.upper() == "WAI":
- sig_ref.type = "Grid"
+ sig_ref.ref_type = "Grid"
ll = wab_wai_square_to_lat_lon(ref_id)
if ll:
sig_ref.name = ref_id
@@ -64,10 +64,11 @@ def get_sig_ref_info(sig, ref_id):
elif sig.upper() == "BOTA":
# For BOTA all we can ever generate is the URL, there is no data file or lookup for lat/longs
- sig_ref.type = "Beach"
+ sig_ref.ref_type = "Beach"
if not sig_ref.name:
sig_ref.name = sig_ref.id
- sig_ref.url = "https://www.beachesontheair.com/beaches/" + sig_ref.name.lower().replace(" ", "-")
+ if sig_ref.name:
+ sig_ref.url = "https://www.beachesontheair.com/beaches/" + sig_ref.name.lower().replace(" ", "-")
return sig_ref
### ACTUAL LOOKUP ###
@@ -85,7 +86,7 @@ def get_sig_ref_info(sig, ref_id):
logging.debug("%s database did not contain data for ref %s", sig, ref_id)
except Exception:
- logging.error("Exception when looking up sig_ref info for " + sig + " ref " + ref_id, exc_info=True)
+ logging.exception("Exception when looking up sig_ref info for " + sig + " ref " + ref_id)
return sig_ref
diff --git a/data/alert.py b/data/alert.py
index fd8c4eb..e026104 100644
--- a/data/alert.py
+++ b/data/alert.py
@@ -1,4 +1,3 @@
-import copy
import hashlib
import json
import logging
@@ -128,8 +127,8 @@ class Alert:
self.dx_names = list(
map(lambda c: get_call_info(c, credentials).name, self.dx_calls))
- except Exception as e:
- logging.error("Exception while inferring missing data from spot", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception while inferring missing data from spot")
def to_json(self):
"""JSON serialise"""
diff --git a/data/spot.py b/data/spot.py
index 2423881..322d0fc 100644
--- a/data/spot.py
+++ b/data/spot.py
@@ -1,4 +1,4 @@
-import copy
+import hashlib
import hashlib
import json
import logging
@@ -9,12 +9,12 @@ from datetime import datetime, timedelta
import pytz
from pyhamtools.locator import locator_to_latlong, latlong_to_locator
+from core.call_lookup_helper import get_call_info
from core.config import MAX_SPOT_AGE
from core.constants import MODE_ALIASES, PROPAGATION_MODES
from core.geo_utils import lat_lon_to_cq_zone, lat_lon_to_itu_zone
-from core.call_lookup_helper import get_call_info
-from core.sig_utils import ANY_SIG_REGEX, get_ref_regex_for_sig, get_sig_name_from_comment_name
from core.sig_lookup_helper import populate_missing_sig_ref_info
+from core.sig_utils import ANY_SIG_REGEX, get_ref_regex_for_sig, get_sig_name_from_comment_name
from core.utils import infer_band_from_freq, infer_mode_from_comment, \
infer_mode_from_frequency, infer_mode_type_from_mode, get_flag_for_dxcc
from data.sig_ref import SIGRef
@@ -413,7 +413,7 @@ class Spot:
or (self.dx_location_source == "HOME QTH" and "/" not in (self.dx_call or ""))))
# DE with no digits and APRS servers starting "T2" are not things we can look up location for
- if self.de_call and any(char.isdigit() for char in self.de_call) and not (
+ if self.de_call and any(char.isdigit() for char in str(self.de_call)) and not (
self.de_call.startswith("T2") and self.source == "APRS-IS"):
# DE operator location lookup
if not self.de_latitude:
@@ -421,8 +421,8 @@ class Spot:
self.de_longitude = de_call_info.longitude
self.de_grid = de_call_info.grid
- except Exception as e:
- logging.error("Exception while inferring missing data from spot", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception while inferring missing data from spot")
def to_json(self):
"""JSON serialise"""
diff --git a/docs/running.md b/docs/running.md
index e58c765..9056e05 100644
--- a/docs/running.md
+++ b/docs/running.md
@@ -3,7 +3,7 @@
If you want to run a copy of Spothole with different configuration settings than the main instance, you can download it
and run it on your own local machine or server.
-You will require Python version 3.8 or later. If you encounter an error about `gdal-config` during the following
+You will require Python version 3.10 or later. If you encounter an error about `gdal-config` during the following
process, you will also need `libgdal-dev` installed.
To download and set up Spothole on a Debian server, run the following commands. Other operating systems will likely be
diff --git a/providers/callsigndata/api_query_callsign_data_provider.py b/providers/callsigndata/api_query_callsign_data_provider.py
index 0d21865..c047b61 100644
--- a/providers/callsigndata/api_query_callsign_data_provider.py
+++ b/providers/callsigndata/api_query_callsign_data_provider.py
@@ -1,13 +1,3 @@
-import logging
-from datetime import datetime
-from threading import Thread, Event
-
-import pytz
-from requests import ReadTimeout
-from requests.exceptions import ConnectionError, ConnectTimeout
-
-from core.constants import HTTP_HEADERS
-from core.url_data_cache import URLDataCache
from providers.callsigndata.callsign_data_provider import CallsignDataProvider
diff --git a/providers/callsigndata/callsign_data_provider.py b/providers/callsigndata/callsign_data_provider.py
index 05d15f2..8d4f9a5 100644
--- a/providers/callsigndata/callsign_data_provider.py
+++ b/providers/callsigndata/callsign_data_provider.py
@@ -1,4 +1,3 @@
-import logging
from datetime import datetime
import pytz
diff --git a/providers/callsigndata/clublogapi.py b/providers/callsigndata/clublogapi.py
index d33d441..aa48936 100644
--- a/providers/callsigndata/clublogapi.py
+++ b/providers/callsigndata/clublogapi.py
@@ -41,8 +41,8 @@ class ClublogAPI(APIQueryCallsignDataProvider):
else:
return None
- except Exception as e:
+ except Exception:
self.status = "Error"
- logging.error("Exception when looking up data from Clublog API", e, exc_info=True)
+ logging.exception("Exception when looking up data from Clublog API")
return callsign_data
diff --git a/providers/callsigndata/clublogxml.py b/providers/callsigndata/clublogxml.py
index acbfaa4..41506b3 100644
--- a/providers/callsigndata/clublogxml.py
+++ b/providers/callsigndata/clublogxml.py
@@ -1,8 +1,6 @@
import gzip
import logging
-from datetime import datetime
-import pytz
from pyhamtools import LookupLib, Callinfo
from core.data_store import DATA_STORE
@@ -47,8 +45,8 @@ class ClublogXML(FileDownloadCallsignDataProvider):
self._callinfo = Callinfo(lookuplib)
return True
- except Exception as e:
- logging.error("Exception when loading Clublog XML.", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when loading Clublog XML.")
return False
def _perform_new_lookup(self, callsign, lookup_credentials):
@@ -62,8 +60,8 @@ class ClublogXML(FileDownloadCallsignDataProvider):
else:
return None
- except Exception as e:
+ except Exception:
self.status = "Error"
- logging.error("Exception when looking up data from Clublog XML data", e, exc_info=True)
+ logging.exception("Exception when looking up data from Clublog XML data")
return callsign_data
diff --git a/providers/callsigndata/countryfiles.py b/providers/callsigndata/countryfiles.py
index 1c647bb..1fe65f6 100644
--- a/providers/callsigndata/countryfiles.py
+++ b/providers/callsigndata/countryfiles.py
@@ -26,8 +26,8 @@ class CountryFiles(FileDownloadCallsignDataProvider):
self._callinfo = Callinfo(lookuplib)
return True
- except Exception as e:
- logging.error("Exception when loading Country Files cty.plist.", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when loading Country Files cty.plist.")
return False
def _perform_new_lookup(self, callsign, lookup_credentials):
@@ -41,8 +41,8 @@ class CountryFiles(FileDownloadCallsignDataProvider):
else:
return None
- except Exception as e:
+ except Exception:
self.status = "Error"
- logging.error("Exception when looking up data from Country file", e, exc_info=True)
+ logging.exception("Exception when looking up data from Country file")
return callsign_data
diff --git a/providers/callsigndata/hamqth.py b/providers/callsigndata/hamqth.py
index e214cf9..36065fd 100644
--- a/providers/callsigndata/hamqth.py
+++ b/providers/callsigndata/hamqth.py
@@ -97,15 +97,15 @@ class HamQTH(APIQueryCallsignDataProvider):
logging.warning(f"Timeout when looking up callsign %s using HamQTH", lookup_call)
continue
except Exception:
- logging.error("Exception when looking up callsign %s using HamQTH", lookup_call, exc_info=True)
+ logging.exception("Exception when looking up callsign %s using HamQTH", lookup_call)
continue
# Not found in HamQTH; return a Callsign object with no data so we cache that and don't keep retrying
return Callsign(call=callsign)
- except Exception as e:
+ except Exception:
self.status = "Error"
- logging.error("Exception when looking up data from HamQTH", e, exc_info=True)
+ logging.exception("Exception when looking up data from HamQTH")
# Return None, this won't be cached so we will be asked to query data again for this call next time.
return None
diff --git a/providers/callsigndata/qrz.py b/providers/callsigndata/qrz.py
index 7e6a08a..0c46b80 100644
--- a/providers/callsigndata/qrz.py
+++ b/providers/callsigndata/qrz.py
@@ -106,15 +106,15 @@ class QRZ(APIQueryCallsignDataProvider):
logging.warning(f"Timeout when looking up callsign %s using QRZ.", lookup_call)
continue
except Exception:
- logging.error("Exception when looking up callsign %s using QRZ", lookup_call, exc_info=True)
+ logging.exception("Exception when looking up callsign %s using QRZ", lookup_call)
continue
# Not found in QRZ; return a Callsign object with no data so we cache that and don't keep retrying
return Callsign(call=callsign)
- except Exception as e:
+ except Exception:
self.status = "Error"
- logging.error("Exception when looking up data from QRZ.com", e, exc_info=True)
+ logging.exception("Exception when looking up data from QRZ.com")
# Return None, this won't be cached so we will be asked to query data again for this call next time.
return None
diff --git a/providers/sigrefdata/local_file_sig_ref_data_provider.py b/providers/sigrefdata/local_file_sig_ref_data_provider.py
index 8a99a50..15f7e40 100644
--- a/providers/sigrefdata/local_file_sig_ref_data_provider.py
+++ b/providers/sigrefdata/local_file_sig_ref_data_provider.py
@@ -24,9 +24,9 @@ class LocalFileSIGRefDataProvider(SIGRefDataProvider):
else:
self.status = "Error"
logging.info("Failed to load SIG ref data for " + self.sig_name)
- except Exception as e:
+ except Exception:
self.status = "Error"
- logging.error("Exception in local file SIG Ref Data Provider (" + self.sig_name + ")", e, exc_info=True)
+ logging.exception("Exception in local file SIG Ref Data Provider (" + self.sig_name + ")")
def _file_to_data(self, path):
"""Load a file on the given path and turn it into SIG Ref data."""
diff --git a/providers/sigrefdata/pnp_kml_sig_ref_data_provider.py b/providers/sigrefdata/pnp_kml_sig_ref_data_provider.py
index 1298759..4ba8d26 100644
--- a/providers/sigrefdata/pnp_kml_sig_ref_data_provider.py
+++ b/providers/sigrefdata/pnp_kml_sig_ref_data_provider.py
@@ -24,7 +24,9 @@ class ParksNPeaksKMLSIGRefDataProvider(FileDownloadSIGRefDataProvider):
k = kml.KML.from_string(http_response.content)
for document in k.features:
+ # noinspection unresolved-references
for folder in document.features:
+ # noinspection unresolved-references
for placemark in folder.features:
description = placemark.description or ""
match = self.REF_PATTERN.search(description)
diff --git a/providers/spot/gma.py b/providers/spot/gma.py
index c35f700..5df218f 100644
--- a/providers/spot/gma.py
+++ b/providers/spot/gma.py
@@ -115,8 +115,8 @@ class GMA(HTTPSpotProvider):
logging.warning(
f"GMA API returned a malformed response when looking up ref {source_spot['REF']}")
except:
- logging.warning("Exception when looking up " + self.REF_INFO_URL_ROOT + source_spot[
- "REF"] + ", ignoring this spot for now", exc_info=True)
+ logging.exception("Exception when looking up " + self.REF_INFO_URL_ROOT + source_spot[
+ "REF"] + ", ignoring this spot for now")
else:
logging.warning(f"The GMA API returned an unexpected response (HTTP {http_response.status_code}).")
diff --git a/providers/staticdata/cqzonedata.py b/providers/staticdata/cqzonedata.py
index 8384fea..30de5f6 100644
--- a/providers/staticdata/cqzonedata.py
+++ b/providers/staticdata/cqzonedata.py
@@ -31,6 +31,6 @@ class CQZoneData(LocalFileStaticDataProvider):
DATA_STORE.cq_zone_data = cq_zone_data
return True
- except Exception as e:
- logging.error("Exception when loading CQ zone data.", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when loading CQ zone data.")
return False
diff --git a/providers/staticdata/ituzonedata.py b/providers/staticdata/ituzonedata.py
index cb5a0c4..45fde7e 100644
--- a/providers/staticdata/ituzonedata.py
+++ b/providers/staticdata/ituzonedata.py
@@ -31,6 +31,6 @@ class ITUZoneData(LocalFileStaticDataProvider):
DATA_STORE.itu_zone_data = itu_zone_data
return True
- except Exception as e:
- logging.error("Exception when loading ITU zone data.", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when loading ITU zone data.")
return False
diff --git a/providers/staticdata/k0swe.py b/providers/staticdata/k0swe.py
index 1ac4958..c75055d 100644
--- a/providers/staticdata/k0swe.py
+++ b/providers/staticdata/k0swe.py
@@ -41,8 +41,8 @@ class K0SWE(FileDownloadStaticDataProvider):
return True
- except Exception as e:
- logging.error("Exception when loading K0SWE dxcc.json.", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when loading K0SWE dxcc.json.")
return False
diff --git a/providers/staticdata/local_file_static_data_provider.py b/providers/staticdata/local_file_static_data_provider.py
index aeb3951..f21fdd3 100644
--- a/providers/staticdata/local_file_static_data_provider.py
+++ b/providers/staticdata/local_file_static_data_provider.py
@@ -25,9 +25,9 @@ class LocalFileStaticDataProvider(StaticDataProvider):
else:
self.status = "Error"
logging.error("Failed to load data for " + self.name)
- except Exception as e:
+ except Exception:
self.status = "Error"
- logging.error("Exception in local file Static Data Provider (" + self.name + ")", e, exc_info=True)
+ logging.exception("Exception in local file Static Data Provider (" + self.name + ")")
def stop(self):
self._stop = True
diff --git a/server/handlers/api/addspot.py b/server/handlers/api/addspot.py
index 34b7c92..ff9ca3b 100644
--- a/server/handlers/api/addspot.py
+++ b/server/handlers/api/addspot.py
@@ -232,8 +232,8 @@ class APISpotHandler(tornado.web.RequestHandler):
self.set_header("Cache-Control", "no-store")
self.set_header("Content-Type", "application/json")
- except Exception as e:
- logging.error("Exception when handling client request to add spot API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to add spot API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
self.set_header("Cache-Control", "no-store")
diff --git a/server/handlers/api/alerts.py b/server/handlers/api/alerts.py
index c650d4a..756d853 100644
--- a/server/handlers/api/alerts.py
+++ b/server/handlers/api/alerts.py
@@ -1,5 +1,4 @@
import copy
-import inspect
import logging
from datetime import datetime
from typing import Any
@@ -53,28 +52,18 @@ class APIAlertsHandler(tornado.web.RequestHandler):
data = get_alert_list_with_filters(self._alerts, query_params)
if credentials:
data = self._enrich(data, credentials)
- find_bad_values(data)
self.write(safe_json_dumps(data))
self.set_status(200)
except ValueError as e:
self.write(safe_json_dumps("Bad request - " + str(e)))
self.set_status(400)
- except Exception as e:
- logging.error("Exception when handling client request to alerts API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to alerts API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
self.set_header("Cache-Control", "no-store")
self.set_header("Content-Type", "application/json")
-def find_bad_values(obj, path="data"):
- if isinstance(obj, dict):
- for k, v in obj.items():
- find_bad_values(v, f"{path}[{k!r}]")
- elif isinstance(obj, (list, tuple)):
- for i, v in enumerate(obj):
- find_bad_values(v, f"{path}[{i}]")
- elif inspect.isbuiltin(obj) or inspect.ismethod(obj) or inspect.isfunction(obj):
- print(f"Found bad value at {path}: {obj!r}")
class APIAlertsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
"""API request handler for /api/v2/alerts/stream"""
@@ -116,8 +105,8 @@ class APIAlertsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
# argument.
self._sse_alert_broadcaster.register(self)
- except Exception as e:
- logging.warning("Exception when serving SSE socket: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when serving SSE socket")
self.close()
def close(self):
@@ -135,8 +124,8 @@ class APIAlertsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
alert = copy.deepcopy(alert)
alert.infer_missing(self._credentials)
self.write_message(msg=safe_json_dumps(alert))
- except Exception as e:
- logging.warning("Exception in SSE callback, connection will be closed: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception in SSE callback, connection will be closed")
self.close()
diff --git a/server/handlers/api/dxstats.py b/server/handlers/api/dxstats.py
index 18e87a7..4f4766f 100644
--- a/server/handlers/api/dxstats.py
+++ b/server/handlers/api/dxstats.py
@@ -59,7 +59,7 @@ class APIDxStatsHandler(tornado.web.RequestHandler):
self.set_header("Cache-Control", "no-store")
self.set_header("Content-Type", "application/json")
- except Exception as e:
- logging.error("Exception when handling client request to dx stats API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to dx stats API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
diff --git a/server/handlers/api/lookups.py b/server/handlers/api/lookups.py
index 9be0f0e..55add60 100644
--- a/server/handlers/api/lookups.py
+++ b/server/handlers/api/lookups.py
@@ -56,8 +56,8 @@ class APILookupCallHandler(tornado.web.RequestHandler):
self.write(safe_json_dumps("Error - call must be provided"))
self.set_status(422)
- except Exception as e:
- logging.error("Exception when handling client request to call lookup API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to call lookup API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
@@ -108,8 +108,8 @@ class APILookupSIGRefHandler(tornado.web.RequestHandler):
self.write(safe_json_dumps("Error - sig and id must be provided"))
self.set_status(422)
- except Exception as e:
- logging.error("Exception when handling client request to sig ref lookup API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to sig ref lookup API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
@@ -170,8 +170,8 @@ class APILookupGridHandler(tornado.web.RequestHandler):
self.write(safe_json_dumps("Error - grid must be provided"))
self.set_status(422)
- except Exception as e:
- logging.error("Exception when handling client request to grid ref lookup API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to grid ref lookup API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
diff --git a/server/handlers/api/options.py b/server/handlers/api/options.py
index 5c2e855..8036768 100644
--- a/server/handlers/api/options.py
+++ b/server/handlers/api/options.py
@@ -82,7 +82,7 @@ class APIOptionsHandler(tornado.web.RequestHandler):
self.set_header("Cache-Control", "no-store")
self.set_header("Content-Type", "application/json")
- except Exception as e:
- logging.error("Exception when handling client request to options API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to options API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
diff --git a/server/handlers/api/solar_conditions.py b/server/handlers/api/solar_conditions.py
index 1efe105..52a27f8 100644
--- a/server/handlers/api/solar_conditions.py
+++ b/server/handlers/api/solar_conditions.py
@@ -36,7 +36,7 @@ class APISolarConditionsHandler(tornado.web.RequestHandler):
self.set_header("Cache-Control", "no-store")
self.set_header("Content-Type", "application/json")
- except Exception as e:
- logging.error("Exception when handling client request to solar conditions API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to solar conditions API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
diff --git a/server/handlers/api/spots.py b/server/handlers/api/spots.py
index c4b7331..817faff 100644
--- a/server/handlers/api/spots.py
+++ b/server/handlers/api/spots.py
@@ -57,8 +57,8 @@ class APISpotsHandler(tornado.web.RequestHandler):
except ValueError as e:
self.write(safe_json_dumps("Bad request - " + str(e)))
self.set_status(400)
- except Exception as e:
- logging.error("Excedption when handling client request to spots API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Excedption when handling client request to spots API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
self.set_header("Cache-Control", "no-store")
@@ -107,8 +107,8 @@ class APISpotsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
# argument.
self._sse_spot_broadcaster.register(self)
- except Exception as e:
- logging.warning("Exception when serving SSE socket: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when serving SSE socket")
self.close()
def close(self):
@@ -127,8 +127,8 @@ class APISpotsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
spot = copy.deepcopy(spot)
spot.infer_missing(self._credentials)
self.write_message(msg=safe_json_dumps(spot))
- except Exception as e:
- logging.warning("Exception in SSE callback, connection will be closed: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception in SSE callback, connection will be closed")
self.close()
diff --git a/server/handlers/api/status.py b/server/handlers/api/status.py
index 5ee6f1d..63c9ef6 100644
--- a/server/handlers/api/status.py
+++ b/server/handlers/api/status.py
@@ -36,7 +36,7 @@ class APIStatusHandler(tornado.web.RequestHandler):
self.set_header("Cache-Control", "no-store")
self.set_header("Content-Type", "application/json")
- except Exception as e:
- logging.error("Exception when handling client request to status API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to status API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
diff --git a/server/handlers/api/v1_addspot.py b/server/handlers/api/v1_addspot.py
index 83d584b..e7ba922 100644
--- a/server/handlers/api/v1_addspot.py
+++ b/server/handlers/api/v1_addspot.py
@@ -125,8 +125,8 @@ class V1APISpotHandler(tornado.web.RequestHandler):
self.set_header("Cache-Control", "no-store")
self.set_header("Content-Type", "application/json")
- except Exception as e:
- logging.error("Exception when handling client request to add spot API: %s", e, exc_info=True)
+ except Exception:
+ logging.exception("Exception when handling client request to add spot API")
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
self.set_header("Cache-Control", "no-store")
diff --git a/server/handlers/api/v1_compatability.py b/server/handlers/api/v1_compatability.py
index 054f4a5..5608ca8 100644
--- a/server/handlers/api/v1_compatability.py
+++ b/server/handlers/api/v1_compatability.py
@@ -1,5 +1,7 @@
import tornado
from tornado.httpclient import AsyncHTTPClient
+from tornado.httputil import HTTPHeaders
+
class V1RedirectHandler(tornado.web.RequestHandler):
"""Transparently proxies requests from the old API to the new one,
@@ -30,13 +32,14 @@ class V1RedirectHandler(tornado.web.RequestHandler):
raise tornado.web.HTTPError(502, reason=str(e))
self.set_status(response.code, response.reason)
- for name, value in response.headers.get_all():
- # Let Tornado recompute these for the outgoing response
- if name.lower() not in ("content-length", "transfer-encoding", "connection"):
- self.add_header(name, value)
- if response.body:
- self.write(response.body)
- self.finish()
+ if isinstance(response.headers, HTTPHeaders):
+ for name, value in response.headers.get_all():
+ # Let Tornado recompute these for the outgoing response
+ if name.lower() not in ("content-length", "transfer-encoding", "connection"):
+ self.add_header(name, value)
+ if response.body:
+ self.write(response.body)
+ await self.finish()
async def get(self, path):
await self._proxy(path)
diff --git a/templates/add_spot.html b/templates/add_spot.html
index 9f0944a..18815d7 100644
--- a/templates/add_spot.html
+++ b/templates/add_spot.html
@@ -76,7 +76,7 @@
-
+
diff --git a/templates/alerts.html b/templates/alerts.html
index 91b3632..9ecd260 100644
--- a/templates/alerts.html
+++ b/templates/alerts.html
@@ -82,7 +82,7 @@
-
+
diff --git a/templates/bands.html b/templates/bands.html
index 63a94d0..5314f1e 100644
--- a/templates/bands.html
+++ b/templates/bands.html
@@ -79,8 +79,8 @@
-
-
+
+
diff --git a/templates/base.html b/templates/base.html
index c954de4..de563f0 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -1,6 +1,6 @@
{% extends "skeleton.html" %}
{% block head_extra %}
-
+
@@ -15,10 +15,10 @@
window.fetchEventSource = fetchEventSource;
-
-
-
-
+
+
+
+
{% end %}
{% block body %}