mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-06-24 05:35:10 +00:00
Implement spotting to Tiles on the Air. #95
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user