From d529f628452dfff5436975e7b1fe0ed09dfbfdb5 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 27 Jun 2023 16:41:58 +0200 Subject: [PATCH] tweak distill importer --- changedetectionio/importer.py | 8 +++----- changedetectionio/tests/test_import.py | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/changedetectionio/importer.py b/changedetectionio/importer.py index a420ea1e..f046c895 100644 --- a/changedetectionio/importer.py +++ b/changedetectionio/importer.py @@ -85,7 +85,8 @@ class import_distill_io_json(Importer): now = time.time() self.new_uuids=[] - + # @todo Use JSONSchema like in the API to validate here. + try: data = json.loads(data.strip()) except json.decoder.JSONDecodeError: @@ -120,11 +121,8 @@ class import_distill_io_json(Importer): except IndexError: pass -# Does this need to be here anymore? - if d.get('tags', False): - extras['tags'] = ", ".join(d['tags']) - new_uuid = datastore.add_watch(url=d['uri'].strip(), + tag=",".join(d.get('tags', [])), extras=extras, write_to_disk_now=False) diff --git a/changedetectionio/tests/test_import.py b/changedetectionio/tests/test_import.py index 88f541b4..a044ff79 100644 --- a/changedetectionio/tests/test_import.py +++ b/changedetectionio/tests/test_import.py @@ -112,6 +112,7 @@ def test_import_distillio(client, live_server): # did the tags work? res = client.get( url_for("index")) + # check tags assert b"nice stuff" in res.data assert b"nerd-news" in res.data