From 5efca75f6fc15b17e26d80f8e88c6fd2196b2189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sat, 28 Dec 2024 15:59:59 +0100 Subject: [PATCH] add poc api settings --- src/c3nav/mapdata/management/commands/importpoc.py | 2 +- src/c3nav/settings.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/c3nav/mapdata/management/commands/importpoc.py b/src/c3nav/mapdata/management/commands/importpoc.py index bff65cbe..cf721497 100644 --- a/src/c3nav/mapdata/management/commands/importpoc.py +++ b/src/c3nav/mapdata/management/commands/importpoc.py @@ -36,7 +36,7 @@ class Command(BaseCommand): help = 'import APs from noc' def handle(self, *args, **options): - r = requests.get(settings.POC_BASE+"antenna-locations") + r = requests.get(settings.POC_BASE+"/antenna-locations", headers={'ApiKey': settings.POC_API_SECRET}) r.raise_for_status() items = TypeAdapter(list[PocImportItem]).validate_python(r.json()) diff --git a/src/c3nav/settings.py b/src/c3nav/settings.py index 4724f18e..3cd38f07 100644 --- a/src/c3nav/settings.py +++ b/src/c3nav/settings.py @@ -223,6 +223,9 @@ if not HUB_API_SECRET: NOC_BASE = config.get('c3nav', 'noc_base', fallback='').removesuffix('/') NOC_LAYERS = NocLayersSchema.validate_json(config.get('c3nav', 'noc_layers', fallback='{}')) +POC_API_BASE = config.get('c3nav', 'poc_api_base', fallback='').removesuffix('/') +POC_API_SECRET = config.get('c3nav', 'poc_api_secret', fallback='') + _db_backend = config.get('database', 'backend', fallback='sqlite3') DATABASES: dict[str, dict[str, str | int | Path]] = { 'default': env.db_url('C3NAV_DATABASE') if 'C3NAV_DATABASE' in env else {