mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-12-15 16:43:38 +00:00
Implement WWFF reference lookup. Closes #76
This commit is contained in:
@@ -69,7 +69,16 @@ def get_sig_ref_info(sig, sig_ref_id):
|
|||||||
sig_ref.latitude = data["latitude"] if "latitude" in data else None
|
sig_ref.latitude = data["latitude"] if "latitude" in data else None
|
||||||
sig_ref.longitude = data["longitude"] if "longitude" in data else None
|
sig_ref.longitude = data["longitude"] if "longitude" in data else None
|
||||||
elif sig.upper() == "WWFF":
|
elif sig.upper() == "WWFF":
|
||||||
sig_ref.url = "https://wwff.co/directory/?showRef=" + sig_ref_id
|
wwff_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://wwff.co/wwff-data/wwff_directory.csv",
|
||||||
|
headers=HTTP_HEADERS)
|
||||||
|
wwff_dr = csv.DictReader(wwff_csv_data.content.decode().splitlines())
|
||||||
|
for row in wwff_dr:
|
||||||
|
if row["reference"] == sig_ref_id:
|
||||||
|
sig_ref.name = row["name"] if "name" in row else None
|
||||||
|
sig_ref.url = "https://wwff.co/directory/?showRef=" + sig_ref_id
|
||||||
|
sig_ref.grid = row["iaruLocator"] if "iaruLocator" in row else None
|
||||||
|
sig_ref.latitude = float(row["latitude"]) if "latitude" in row else None
|
||||||
|
sig_ref.longitude = float(row["longitude"]) if "longitude" in row else None
|
||||||
elif sig.upper() == "SIOTA":
|
elif sig.upper() == "SIOTA":
|
||||||
siota_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.silosontheair.com/data/silos.csv",
|
siota_csv_data = SEMI_STATIC_URL_DATA_CACHE.get("https://www.silosontheair.com/data/silos.csv",
|
||||||
headers=HTTP_HEADERS)
|
headers=HTTP_HEADERS)
|
||||||
|
|||||||
Reference in New Issue
Block a user