Code - Abstract out the diff fetch types to make it easier to integrate new ones (#1467)

dont-create-jpg-copy-of-png
dgtlmoon 2 years ago committed by GitHub
parent c454cbb808
commit 4c74d39df0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,5 @@
# HTML to TEXT/JSON DIFFERENCE FETCHER
import hashlib import hashlib
import json import json
import logging import logging

@ -71,7 +71,6 @@ def set_modified_response():
def test_element_removal_output(): def test_element_removal_output():
from changedetectionio import fetch_site_status
from inscriptis import get_text from inscriptis import get_text
# Check text with sub-parts renders correctly # Check text with sub-parts renders correctly

@ -1,7 +1,5 @@
#!/usr/bin/python3 #!/usr/bin/python3
import time
from flask import url_for
from . util import live_server_setup from . util import live_server_setup
from changedetectionio import html_tools from changedetectionio import html_tools
@ -11,7 +9,7 @@ def test_setup(live_server):
# Unit test of the stripper # Unit test of the stripper
# Always we are dealing in utf-8 # Always we are dealing in utf-8
def test_strip_regex_text_func(): def test_strip_regex_text_func():
from changedetectionio import fetch_site_status from ..fetchers import text_json_diff as fetch_site_status
test_content = """ test_content = """
but sometimes we want to remove the lines. but sometimes we want to remove the lines.

@ -11,7 +11,7 @@ def test_setup(live_server):
# Unit test of the stripper # Unit test of the stripper
# Always we are dealing in utf-8 # Always we are dealing in utf-8
def test_strip_text_func(): def test_strip_text_func():
from changedetectionio import fetch_site_status from ..fetchers import text_json_diff as fetch_site_status
test_content = """ test_content = """
Some content Some content

@ -4,8 +4,7 @@ import queue
import time import time
from changedetectionio import content_fetcher from changedetectionio import content_fetcher
from changedetectionio import queuedWatchMetaData from .fetchers.text_json_diff import FilterNotFoundInResponse
from changedetectionio.fetch_site_status import FilterNotFoundInResponse
# A single update worker # A single update worker
# #
@ -153,7 +152,7 @@ class update_worker(threading.Thread):
os.unlink(full_path) os.unlink(full_path)
def run(self): def run(self):
from changedetectionio import fetch_site_status from .fetchers import text_json_diff as fetch_site_status
update_handler = fetch_site_status.perform_site_check(datastore=self.datastore) update_handler = fetch_site_status.perform_site_check(datastore=self.datastore)

Loading…
Cancel
Save