Implement spotting to Tiles on the Air. #95

This commit is contained in:
Ian Renton
2026-06-13 08:17:38 +01:00
parent 1afb407ca5
commit fd21e01c9d
13 changed files with 95 additions and 36 deletions

View File

@@ -21,7 +21,6 @@ class SOTA(HTTPSpotProvider):
SUMMIT_URL_ROOT = "https://api-db2.sota.org.uk/api/summits/"
SUBMIT_URL = "https://api-db2.sota.org.uk/api/spots"
VALID_MODES = ["AM", "CW", "Data", "DV", "FM", "SSB"]
def __init__(self, provider_config):
@@ -77,23 +76,24 @@ class SOTA(HTTPSpotProvider):
# Figure out a valid mode. Borrowed this from PoLo :)
# https://github.com/ham2k/app-polo/blob/main/src/extensions/activities/sota/SOTAPostSelfSpot.js
if spot.mode and spot.mode not in self.VALID_MODES:
if spot.mode in SSB_SUB_MODES:
spot.mode = "SSB"
elif spot.mode in DV_SUB_MODES:
spot.mode = "DV"
mode = spot.mode
if mode and mode not in self.VALID_MODES:
if mode in SSB_SUB_MODES:
mode = "SSB"
elif mode in DV_SUB_MODES:
mode = "DV"
else:
spot.mode = "Data"
mode = "Data"
body = {
"activatorCallsign": spot.dx_call,
"associationCode": ref_split[0],
"summitCode": ref_split[1],
"frequency": str(spot.freq / 1000000.0),
"mode": spot.mode or "",
"posterCallsign": spot.de_call,
"frequency": spot.freq / 1000000.0,
"mode": mode or "",
"callsign": spot.de_call,
"comments": spot.comment or "",
"type": "TEST" # todo remove once testing complete
"type": "TEST" # todo replatce with NORMAL/QRT once testing complete
}
headers = {**HTTP_HEADERS, "Authorization": "bearer " + access_token, "id_token": id_token, "Content-Type": "application/json"}
response = requests.post(self.SUBMIT_URL, json=body, headers=headers, timeout=(5, 30))