Download cty.plist separately so errors can be better handled

This commit is contained in:
Ian Renton
2025-10-13 19:32:29 +01:00
parent a5a4981b7e
commit dbeebe32f3
11 changed files with 53 additions and 24 deletions

View File

@@ -4,6 +4,7 @@ from datetime import datetime, timedelta
import requests
from requests_cache import CachedSession
from core.constants import HTTP_HEADERS
from data.spot import Spot
from spotproviders.http_spot_provider import HTTPSpotProvider
@@ -34,7 +35,7 @@ class SOTA(HTTPSpotProvider):
new_spots = []
# OK, if the epoch actually changed, now we make the real request for data.
if epoch_changed:
source_data = requests.get(self.SPOTS_URL, headers=self.HTTP_HEADERS).json()
source_data = requests.get(self.SPOTS_URL, headers=HTTP_HEADERS).json()
# Iterate through source data
for source_spot in source_data:
# Convert to our spot format
@@ -55,7 +56,7 @@ class SOTA(HTTPSpotProvider):
# SOTA doesn't give summit lat/lon/grid in the main call, so we need another separate call for this
try:
summit_response = self.SUMMIT_DATA_CACHE.get(self.SUMMIT_URL_ROOT + source_spot["summitCode"], headers=self.HTTP_HEADERS)
summit_response = self.SUMMIT_DATA_CACHE.get(self.SUMMIT_URL_ROOT + source_spot["summitCode"], headers=HTTP_HEADERS)
summit_data = summit_response.json()
spot.grid = summit_data["locator"]
spot.latitude = summit_data["latitude"]