Support API key for GMA spots #112

This commit is contained in:
Ian Renton
2026-06-21 08:04:49 +01:00
parent 3953271c5f
commit 57c6751c0d
10 changed files with 52 additions and 17 deletions

View File

@@ -19,7 +19,12 @@ class GMA(HTTPSpotProvider):
REF_INFO_URL_ROOT = "https://www.cqgma.org/api/ref/?"
def __init__(self, provider_config):
super().__init__(provider_config, self.SPOTS_URL, self.POLL_INTERVAL_SEC)
# Ensure there is an API key in our config, and set up the query URL using it
self.api_key = provider_config.get("api-key", "")
if self.api_key != "":
super().__init__(provider_config, self.SPOTS_URL + "?key=" + self.api_key, self.POLL_INTERVAL_SEC)
else:
logging.warning("GMA spot provider configured but no api key was provided, this API will not be queried.")
def _http_response_to_spots(self, http_response):
new_spots = []