repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/parsing_stream.py
examples/parsing_stream.py
from typing import List import rich from pydantic import BaseModel from openai import OpenAI class Step(BaseModel): explanation: str output: str class MathResponse(BaseModel): steps: List[Step] final_answer: str client = OpenAI() with client.chat.completions.stream( model="gpt-4o-2024-08-06...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/image_stream.py
examples/image_stream.py
#!/usr/bin/env python import base64 from pathlib import Path from openai import OpenAI client = OpenAI() def main() -> None: """Example of OpenAI image streaming with partial images.""" stream = client.images.generate( model="gpt-image-1", prompt="A cute baby sea otter", n=1, ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/demo.py
examples/demo.py
#!/usr/bin/env -S poetry run python from openai import OpenAI # gets API Key from environment variable OPENAI_API_KEY client = OpenAI() # Non-streaming: print("----- standard request -----") completion = client.chat.completions.create( model="gpt-4", messages=[ { "role": "user", ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/parsing.py
examples/parsing.py
from typing import List import rich from pydantic import BaseModel from openai import OpenAI class Step(BaseModel): explanation: str output: str class MathResponse(BaseModel): steps: List[Step] final_answer: str client = OpenAI() completion = client.chat.completions.parse( model="gpt-4o-202...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/parsing_tools.py
examples/parsing_tools.py
from enum import Enum from typing import List, Union import rich from pydantic import BaseModel import openai from openai import OpenAI class Table(str, Enum): orders = "orders" customers = "customers" products = "products" class Column(str, Enum): id = "id" status = "status" expected_deli...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/picture.py
examples/picture.py
#!/usr/bin/env python from openai import OpenAI # gets OPENAI_API_KEY from your environment variables openai = OpenAI() prompt = "An astronaut lounging in a tropical resort in space, pixel art" model = "dall-e-3" def main() -> None: # Generate an image based on the prompt response = openai.images.generate(...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/azure.py
examples/azure.py
from openai import AzureOpenAI # may change in the future # https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-versioning api_version = "2023-07-01-preview" # gets the API Key from environment variable AZURE_OPENAI_API_KEY client = AzureOpenAI( api_version=api_version, # https://lea...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/video.py
examples/video.py
#!/usr/bin/env -S poetry run python import asyncio from openai import AsyncOpenAI client = AsyncOpenAI() async def main() -> None: video = await client.videos.create_and_poll( model="sora-2", prompt="A video of the words 'Thank you' in sparkling letters", ) if video.status == "complete...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses_input_tokens.py
examples/responses_input_tokens.py
from typing import List from openai import OpenAI from openai.types.responses.tool_param import ToolParam from openai.types.responses.response_input_item_param import ResponseInputItemParam def main() -> None: client = OpenAI() tools: List[ToolParam] = [ { "type": "function", ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/async_demo.py
examples/async_demo.py
#!/usr/bin/env -S poetry run python import asyncio from openai import AsyncOpenAI # gets API Key from environment variable OPENAI_API_KEY client = AsyncOpenAI() async def main() -> None: stream = await client.completions.create( model="gpt-3.5-turbo-instruct", prompt="Say this is a test", ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/realtime/push_to_talk_app.py
examples/realtime/push_to_talk_app.py
#!/usr/bin/env uv run #################################################################### # Sample TUI app with a push to talk interface to the Realtime API # # If you have `uv` installed and the `OPENAI_API_KEY` # # environment variable set, you can run this example with just # # ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/realtime/audio_util.py
examples/realtime/audio_util.py
from __future__ import annotations import io import base64 import asyncio import threading from typing import Callable, Awaitable import numpy as np import pyaudio import sounddevice as sd from pydub import AudioSegment from openai.resources.realtime.realtime import AsyncRealtimeConnection CHUNK_LENGTH_S = 0.05 # ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/realtime/azure_realtime.py
examples/realtime/azure_realtime.py
import os import asyncio from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider from openai import AsyncAzureOpenAI # Azure OpenAI Realtime Docs # How-to: https://learn.microsoft.com/azure/ai-services/openai/how-to/realtime-audio # Supported models and API versions: https://learn.microsoft...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/realtime/realtime.py
examples/realtime/realtime.py
#!/usr/bin/env rye run python import asyncio from openai import AsyncOpenAI # Azure OpenAI Realtime Docs # How-to: https://learn.microsoft.com/azure/ai-services/openai/how-to/realtime-audio # Supported models and API versions: https://learn.microsoft.com/azure/ai-services/openai/how-to/realtime-audio#supported-model...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/streaming.py
examples/responses/streaming.py
from typing import List import rich from pydantic import BaseModel from openai import OpenAI class Step(BaseModel): explanation: str output: str class MathResponse(BaseModel): steps: List[Step] final_answer: str client = OpenAI() with client.responses.stream( input="solve 8x + 31 = 2", ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/streaming_tools.py
examples/responses/streaming_tools.py
from enum import Enum from typing import List, Union import rich from pydantic import BaseModel import openai from openai import OpenAI class Table(str, Enum): orders = "orders" customers = "customers" products = "products" class Column(str, Enum): id = "id" status = "status" expected_deli...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/background_async.py
examples/responses/background_async.py
import asyncio from typing import List import rich from pydantic import BaseModel from openai._client import AsyncOpenAI class Step(BaseModel): explanation: str output: str class MathResponse(BaseModel): steps: List[Step] final_answer: str async def main() -> None: client = AsyncOpenAI() ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/structured_outputs_tools.py
examples/responses/structured_outputs_tools.py
from enum import Enum from typing import List, Union import rich from pydantic import BaseModel import openai from openai import OpenAI class Table(str, Enum): orders = "orders" customers = "customers" products = "products" class Column(str, Enum): id = "id" status = "status" expected_deli...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/background_streaming.py
examples/responses/background_streaming.py
#!/usr/bin/env -S rye run python from typing import List import rich from pydantic import BaseModel from openai import OpenAI class Step(BaseModel): explanation: str output: str class MathResponse(BaseModel): steps: List[Step] final_answer: str client = OpenAI() id = None with client.responses.s...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/background.py
examples/responses/background.py
from typing import List import rich from pydantic import BaseModel from openai import OpenAI class Step(BaseModel): explanation: str output: str class MathResponse(BaseModel): steps: List[Step] final_answer: str client = OpenAI() id = None with client.responses.create( input="solve 8x + 31 ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/structured_outputs.py
examples/responses/structured_outputs.py
from typing import List import rich from pydantic import BaseModel from openai import OpenAI class Step(BaseModel): explanation: str output: str class MathResponse(BaseModel): steps: List[Step] final_answer: str client = OpenAI() rsp = client.responses.parse( input="solve 8x + 31 = 2", ...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/background_streaming_async.py
examples/responses/background_streaming_async.py
import asyncio from typing import List import rich from pydantic import BaseModel from openai import AsyncOpenAI class Step(BaseModel): explanation: str output: str class MathResponse(BaseModel): steps: List[Step] final_answer: str async def main() -> None: client = AsyncOpenAI() id = No...
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
openai/openai-python
https://github.com/openai/openai-python/blob/d3e632171c7842abf97b26379f564531d80ad096/examples/responses/__init__.py
examples/responses/__init__.py
python
Apache-2.0
d3e632171c7842abf97b26379f564531d80ad096
2026-01-04T14:43:29.641198Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetection.py
changedetection.py
#!/usr/bin/env python3 # Only exists for direct CLI usage import changedetectionio if __name__ == '__main__': changedetectionio.main()
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/setup.py
setup.py
#!/usr/bin/env python import codecs import os.path import re import sys from setuptools import setup, find_packages from setuptools.command.build_py import build_py import shutil here = os.path.abspath(os.path.dirname(__file__)) def read(*parts): return codecs.open(os.path.join(here, *parts), 'r').read() def ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/queuedWatchMetaData.py
changedetectionio/queuedWatchMetaData.py
from dataclasses import dataclass, field from typing import Any # So that we can queue some metadata in `item` # https://docs.python.org/3/library/queue.html#queue.PriorityQueue # @dataclass(order=True) class PrioritizedItem: priority: int item: Any=field(compare=False)
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/time_handler.py
changedetectionio/time_handler.py
from functools import lru_cache import arrow from enum import IntEnum class Weekday(IntEnum): """Enumeration for days of the week.""" Monday = 0 Tuesday = 1 Wednesday = 2 Thursday = 3 Friday = 4 Saturday = 5 Sunday = 6 def am_i_inside_time( day_of_week: str, time_str:...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/is_safe_url.py
changedetectionio/is_safe_url.py
""" URL redirect validation module for preventing open redirect vulnerabilities. This module provides functionality to safely validate redirect URLs, ensuring they: 1. Point to internal routes only (no external redirects) 2. Are properly normalized (preventing browser parsing differences) 3. Match registered Flask rou...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/queue_handlers.py
changedetectionio/queue_handlers.py
from blinker import signal from loguru import logger from typing import Dict, List, Any, Optional import heapq import queue import threading try: import janus except ImportError: logger.critical(f"CRITICAL: janus library is required. Install with: pip install janus") raise class RecheckPriorityQueue: ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/languages.py
changedetectionio/languages.py
""" Language configuration for i18n support Automatically discovers available languages from translations directory """ import os from pathlib import Path def get_timeago_locale(flask_locale): """ Convert Flask-Babel locale codes to timeago library locale codes. The Python timeago library (https://github...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/auth_decorator.py
changedetectionio/auth_decorator.py
import os from functools import wraps from flask import current_app, redirect, request from loguru import logger def login_optionally_required(func): """ If password authentication is enabled, verify the user is logged in. To be used as a decorator for routes that should optionally require login. This ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/notification_service.py
changedetectionio/notification_service.py
#!/usr/bin/env python3 """ Notification Service Module Extracted from update_worker.py to provide standalone notification functionality for both sync and async workers """ import datetime import pytz from loguru import logger import time from changedetectionio.notification import default_notification_format, valid_n...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/store.py
changedetectionio/store.py
import shutil from changedetectionio.strtobool import strtobool from changedetectionio.validate_url import is_safe_valid_url from flask import ( flash ) from flask_babel import gettext from .blueprint.rss import RSS_CONTENT_FORMAT_DEFAULT from .html_tools import TRANSLATE_WHITESPACE_TABLE from .model import App...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
true
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/pluggy_interface.py
changedetectionio/pluggy_interface.py
import pluggy import os import importlib import sys from loguru import logger # Global plugin namespace for changedetection.io PLUGIN_NAMESPACE = "changedetectionio" hookspec = pluggy.HookspecMarker(PLUGIN_NAMESPACE) hookimpl = pluggy.HookimplMarker(PLUGIN_NAMESPACE) class ChangeDetectionSpec: """Hook specifica...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/strtobool.py
changedetectionio/strtobool.py
# Because strtobool was removed in python 3.12 distutils _MAP = { 'y': True, 'yes': True, 't': True, 'true': True, 'on': True, '1': True, 'n': False, 'no': False, 'f': False, 'false': False, 'off': False, '0': False } def strtobool(value): try: return _MAP[...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/worker_handler.py
changedetectionio/worker_handler.py
""" Worker management module for changedetection.io Handles asynchronous workers for dynamic worker scaling. Sync worker support has been removed in favor of async-only architecture. """ import asyncio import os import threading import time from loguru import logger # Global worker state running_async_tasks = [] asy...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/flask_app.py
changedetectionio/flask_app.py
#!/usr/bin/env python3 import flask_login import locale import os import queue import sys import threading import time import timeago from blinker import signal from changedetectionio.strtobool import strtobool from threading import Event from changedetectionio.queue_handlers import RecheckPriorityQueue, Notification...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
true
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/validate_url.py
changedetectionio/validate_url.py
from functools import lru_cache from loguru import logger from urllib.parse import urlparse, urlunparse, parse_qsl, urlencode def normalize_url_encoding(url): """ Safely encode a URL's query parameters, regardless of whether they're already encoded. Why this is necessary: URLs can arrive in various s...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/custom_queue.py
changedetectionio/custom_queue.py
import queue import asyncio from blinker import signal from loguru import logger class NotificationQueue(queue.Queue): """ Extended Queue that sends a 'notification_event' signal when notifications are added. This class extends the standard Queue and adds a signal emission after a notification is...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/__init__.py
changedetectionio/__init__.py
#!/usr/bin/env python3 # Read more https://github.com/dgtlmoon/changedetection.io/wiki # Semver means never use .01, or 00. Should be .1. __version__ = '0.51.4' from changedetectionio.strtobool import strtobool from json.decoder import JSONDecodeError import logging import os import getopt import platform import sign...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/html_tools.py
changedetectionio/html_tools.py
from functools import lru_cache from loguru import logger from typing import List import html import json import re # HTML added to be sure each result matching a filter (.example) gets converted to a new line by Inscriptis TEXT_FILTER_LIST_LINE_SUFFIX = "<br>" TRANSLATE_WHITESPACE_TABLE = str.maketrans('', '', '\r\n...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/gc_cleanup.py
changedetectionio/gc_cleanup.py
#!/usr/bin/env python3 import ctypes import gc import re import psutil import sys import threading import importlib from loguru import logger def memory_cleanup(app=None): """ Perform comprehensive memory cleanup operations and log memory usage at each step with nicely formatted numbers. Args: ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/rss_tools.py
changedetectionio/rss_tools.py
""" RSS/Atom feed processing tools for changedetection.io """ from loguru import logger import re def cdata_in_document_to_text(html_content: str, render_anchor_tag_content=False) -> str: """ Process CDATA sections in HTML/XML content - inline replacement. Args: html_content: The HTML/XML conten...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/async_update_worker.py
changedetectionio/async_update_worker.py
from blinker import signal from .processors.exceptions import ProcessorException import changedetectionio.content_fetchers.exceptions as content_fetchers_exceptions from changedetectionio.processors.text_json_diff.processor import FilterNotFoundInResponse from changedetectionio import html_tools from changedetectionio...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/forms.py
changedetectionio/forms.py
import os import re from loguru import logger from wtforms.widgets.core import TimeInput from flask_babel import lazy_gettext as _l, gettext from changedetectionio.blueprint.rss import RSS_FORMAT_TYPES, RSS_TEMPLATE_TYPE_OPTIONS, RSS_TEMPLATE_HTML_DEFAULT from changedetectionio.conditions.form import ConditionFormRow ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
true
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/requests.py
changedetectionio/content_fetchers/requests.py
from loguru import logger import hashlib import os import re import asyncio from functools import partial from changedetectionio import strtobool from changedetectionio.content_fetchers.exceptions import BrowserStepsInUnsupportedFetcher, EmptyReply, Non200ErrorCodeReceived from changedetectionio.content_fetchers.base i...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/webdriver_selenium.py
changedetectionio/content_fetchers/webdriver_selenium.py
import os import time from loguru import logger from changedetectionio.content_fetchers.base import Fetcher class fetcher(Fetcher): if os.getenv("WEBDRIVER_URL"): fetcher_description = f"WebDriver Chrome/Javascript via \"{os.getenv('WEBDRIVER_URL', '')}\"" else: fetcher_description = "WebDriv...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/playwright.py
changedetectionio/content_fetchers/playwright.py
import json import os from urllib.parse import urlparse from loguru import logger from changedetectionio.content_fetchers import SCREENSHOT_MAX_HEIGHT_DEFAULT, visualselector_xpath_selectors, \ SCREENSHOT_SIZE_STITCH_THRESHOLD, SCREENSHOT_MAX_TOTAL_HEIGHT, XPATH_ELEMENT_JS, INSTOCK_DATA_JS, FAVICON_FETCHER_JS fro...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/puppeteer.py
changedetectionio/content_fetchers/puppeteer.py
import asyncio import json import os import websockets.exceptions from urllib.parse import urlparse from loguru import logger from changedetectionio.content_fetchers import SCREENSHOT_MAX_HEIGHT_DEFAULT, visualselector_xpath_selectors, \ SCREENSHOT_SIZE_STITCH_THRESHOLD, SCREENSHOT_DEFAULT_QUALITY, XPATH_ELEMENT_...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/__init__.py
changedetectionio/content_fetchers/__init__.py
import sys from changedetectionio.strtobool import strtobool from loguru import logger from changedetectionio.content_fetchers.exceptions import BrowserStepsStepException import os # Visual Selector scraper - 'Button' is there because some sites have <button>OUT OF STOCK</button>. visualselector_xpath_selectors = 'div...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/screenshot_handler.py
changedetectionio/content_fetchers/screenshot_handler.py
# Pages with a vertical height longer than this will use the 'stitch together' method. # - Many GPUs have a max texture size of 16384x16384px (or lower on older devices). # - If a page is taller than ~8000–10000px, it risks exceeding GPU memory limits. # - This is especially important on headless Chromium, where Playw...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/base.py
changedetectionio/content_fetchers/base.py
import os from abc import abstractmethod from loguru import logger from changedetectionio.content_fetchers import BrowserStepsStepException def manage_user_agent(headers, current_ua=''): """ Basic setting of user-agent NOTE!!!!!! The service that does the actual Chrome fetching should handle any anti-ro...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/exceptions/__init__.py
changedetectionio/content_fetchers/exceptions/__init__.py
from loguru import logger class Non200ErrorCodeReceived(Exception): def __init__(self, status_code, url, screenshot=None, xpath_data=None, page_html=None): # Set this so we can use it in other parts of the app self.status_code = status_code self.url = url self.screenshot = screensho...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/content_fetchers/res/__init__.py
changedetectionio/content_fetchers/res/__init__.py
# resources for browser injection/scraping
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/model/Watch.py
changedetectionio/model/Watch.py
from blinker import signal from changedetectionio.validate_url import is_safe_valid_url from changedetectionio.strtobool import strtobool from changedetectionio.jinja2_custom import render as jinja_render from . import watch_base import os import re from pathlib import Path from loguru import logger from .. import ji...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
true
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/model/App.py
changedetectionio/model/App.py
from os import getenv from copy import deepcopy from changedetectionio.blueprint.rss import RSS_FORMAT_TYPES, RSS_CONTENT_FORMAT_DEFAULT from changedetectionio.notification import ( default_notification_body, default_notification_format, default_notification_title, ) # Equal to or greater than this numbe...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/model/Tag.py
changedetectionio/model/Tag.py
from changedetectionio.model import watch_base class model(watch_base): def __init__(self, *arg, **kw): super(model, self).__init__(*arg, **kw) self['overrides_watch'] = kw.get('default', {}).get('overrides_watch') if kw.get('default'): self.update(kw['default']) ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/model/__init__.py
changedetectionio/model/__init__.py
import os import uuid from changedetectionio import strtobool USE_SYSTEM_DEFAULT_NOTIFICATION_FORMAT_FOR_WATCH = 'System default' CONDITIONS_MATCH_LOGIC_DEFAULT = 'ALL' class watch_base(dict): def __init__(self, *arg, **kw): self.update({ # Custom notification content # Re #110, s...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/notification/email_helpers.py
changedetectionio/notification/email_helpers.py
def as_monospaced_html_email(content: str, title: str) -> str: """ Wraps `content` in a minimal, email-safe HTML template that forces monospace rendering across Gmail, Hotmail, Apple Mail, etc. Args: content: The body text (plain text or HTML-like). title: The title plaintext Return...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/notification/handler.py
changedetectionio/notification/handler.py
import time import re import apprise from apprise import NotifyFormat from loguru import logger from urllib.parse import urlparse from .apprise_plugin.assets import apprise_asset, APPRISE_AVATAR_URL from .email_helpers import as_monospaced_html_email from ..diff import HTML_REMOVED_STYLE, REMOVED_PLACEMARKER_OPEN, REM...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/notification/__init__.py
changedetectionio/notification/__init__.py
from changedetectionio.model import USE_SYSTEM_DEFAULT_NOTIFICATION_FORMAT_FOR_WATCH default_notification_format = 'htmlcolor' default_notification_body = '{{watch_url}} had a change.\n---\n{{diff}}\n---\n' default_notification_title = 'ChangeDetection.io Notification - {{watch_url}}' # The values (markdown etc) are ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/notification/apprise_plugin/discord.py
changedetectionio/notification/apprise_plugin/discord.py
""" Custom Discord plugin for changedetection.io Extends Apprise's Discord plugin to support custom colored embeds for removed/added content """ from apprise.plugins.discord import NotifyDiscord from apprise.decorators import notify from apprise.common import NotifyFormat from loguru import logger # Import placeholder...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/notification/apprise_plugin/assets.py
changedetectionio/notification/apprise_plugin/assets.py
from apprise import AppriseAsset # Refer to: # https://github.com/caronc/apprise/wiki/Development_API#the-apprise-asset-object APPRISE_APP_ID = "changedetection.io" APPRISE_APP_DESC = "ChangeDetection.io best and simplest website monitoring and change detection" APPRISE_APP_URL = "https://changedetection.io" APPRISE_...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/notification/apprise_plugin/custom_handlers.py
changedetectionio/notification/apprise_plugin/custom_handlers.py
""" Custom Apprise HTTP Handlers with format= Parameter Support IMPORTANT: This module works around a limitation in Apprise's @notify decorator. THE PROBLEM: ------------- When using Apprise's @notify decorator to create custom notification handlers, the decorator creates a CustomNotifyPlugin that uses parse_url(...,...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/notification/apprise_plugin/__init__.py
changedetectionio/notification/apprise_plugin/__init__.py
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_nonrenderable_pages.py
changedetectionio/tests/test_nonrenderable_pages.py
#!/usr/bin/env python3 from flask import url_for from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks, delete_all_watches import time import os def set_nonrenderable_response(datastore_path): test_return_data = """<html> <head><title>modified head title</titl...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_ignore.py
changedetectionio/tests/test_ignore.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup, wait_for_all_checks from changedetectionio import html_tools from . util import extract_UUID_from_client import os def set_original_ignore_response(datastore_path): test_return_data = """<html> <body> So...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_share_watch.py
changedetectionio/tests/test_share_watch.py
#!/usr/bin/env python3 import time from flask import url_for from urllib.request import urlopen from .util import set_original_response, set_modified_response, live_server_setup, delete_all_watches import re sleep_time_for_fetch_thread = 3 def test_share_watch(client, live_server, measure_memory_usage, datastore_pa...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_backend.py
changedetectionio/tests/test_backend.py
#!/usr/bin/env python3 import os import time from flask import url_for from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks, extract_rss_token_from_UI, \ extract_UUID_from_client, delete_all_watches sleep_time_for_fetch_thread = 3 # Basic test to check inscriptu...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_filter_exist_changes.py
changedetectionio/tests/test_filter_exist_changes.py
#!/usr/bin/env python3 # https://www.reddit.com/r/selfhosted/comments/wa89kp/comment/ii3a4g7/?context=3 import os import time from flask import url_for from .util import set_original_response, live_server_setup, wait_for_notification_endpoint_output from changedetectionio.model import App def set_response_without_fi...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_auth.py
changedetectionio/tests/test_auth.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup, wait_for_all_checks # test pages with http://username@password:foobar.com/ work def test_basic_auth(client, live_server, measure_memory_usage, datastore_path): # live_server_setup(live_server) # Setup on conftest per...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_backup.py
changedetectionio/tests/test_backup.py
#!/usr/bin/env python3 from .util import set_original_response, live_server_setup, wait_for_all_checks from flask import url_for import io from zipfile import ZipFile import re import time def test_backup(client, live_server, measure_memory_usage, datastore_path): # live_server_setup(live_server) # Setup on conf...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_api_tags.py
changedetectionio/tests/test_api_tags.py
#!/usr/bin/env python3 from flask import url_for from .util import live_server_setup, wait_for_all_checks, set_original_response import json import time def test_api_tags_listing(client, live_server, measure_memory_usage, datastore_path): # live_server_setup(live_server) # Setup on conftest per function api_k...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_clone.py
changedetectionio/tests/test_clone.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup, wait_for_all_checks import os def test_clone_functionality(client, live_server, measure_memory_usage, datastore_path): # live_server_setup(live_server) # Setup on conftest per function with open(os.path.join(da...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_ui.py
changedetectionio/tests/test_ui.py
#!/usr/bin/env python3 from flask import url_for from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks, delete_all_watches from ..forms import REQUIRE_ATLEAST_ONE_TIME_PART_WHEN_NOT_GLOBAL_DEFAULT, REQUIRE_ATLEAST_ONE_TIME_PART_MESSAGE_DEFAULT def test_recheck_time_fi...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_basic_socketio.py
changedetectionio/tests/test_basic_socketio.py
#!/usr/bin/env python3 import time from flask import url_for from .util import ( set_original_response, set_modified_response, live_server_setup, wait_for_all_checks ) from loguru import logger def run_socketio_watch_update_test(client, live_server, password_mode="", datastore_path=""): """Test th...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_i18n.py
changedetectionio/tests/test_i18n.py
#!/usr/bin/env python3 from flask import url_for from .util import live_server_setup def test_language_switching(client, live_server, measure_memory_usage, datastore_path): """ Test that the language switching functionality works correctly. 1. Switch to Italian using the /set-language endpoint 2. Ve...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_css_selector.py
changedetectionio/tests/test_css_selector.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup, wait_for_all_checks import os from ..html_tools import * def set_original_response(datastore_path): test_return_data = """<html> <body> Some initial text<br> <p>Which is across multiple lines</p> ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_ignorehyperlinks.py
changedetectionio/tests/test_ignorehyperlinks.py
#!/usr/bin/env python3 """Test suite for the render/not render anchor tag content functionality""" import time from flask import url_for from .util import live_server_setup, wait_for_all_checks, delete_all_watches import os def set_original_ignore_response(datastore_path): test_return_data = """<html> <bo...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_extract_csv.py
changedetectionio/tests/test_extract_csv.py
#!/usr/bin/env python3 import time from flask import url_for from urllib.request import urlopen from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks import os sleep_time_for_fetch_thread = 3 def test_check_extract_text_from_diff(client, live_server, measure_memory_...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_add_replace_remove_filter.py
changedetectionio/tests/test_add_replace_remove_filter.py
#!/usr/bin/env python3 import os.path import os from flask import url_for from .util import live_server_setup, wait_for_all_checks, wait_for_notification_endpoint_output, delete_all_watches import time from ..diff import ADDED_PLACEMARKER_OPEN def set_original(datastore_path, excluding=None, add_line=None): te...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/util.py
changedetectionio/tests/util.py
#!/usr/bin/env python3 from operator import truediv from flask import make_response, request, current_app from flask import url_for import logging import time import os def set_original_response(datastore_path, extra_title=''): test_return_data = f"""<html> <head><title>head title{extra_title}</title></head> ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_jinja2.py
changedetectionio/tests/test_jinja2.py
#!/usr/bin/env python3 import time import arrow from flask import url_for from .util import live_server_setup, wait_for_all_checks from ..jinja2_custom import render # def test_setup(client, live_server, measure_memory_usage, datastore_path): # # live_server_setup(live_server) # Setup on conftest per function #...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_automatic_follow_ldjson_price.py
changedetectionio/tests/test_automatic_follow_ldjson_price.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup, extract_UUID_from_client, wait_for_all_checks import os def set_response_with_ldjson(datastore_path): test_return_data = """<html> <body> Some initial text<br> <p>Which is across multiple lines</p> ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_ignore_text.py
changedetectionio/tests/test_ignore_text.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup, wait_for_all_checks, delete_all_watches from changedetectionio import html_tools import os # Unit test of the stripper # Always we are dealing in utf-8 def test_strip_text_func(): test_content = """ Some conten...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_access_control.py
changedetectionio/tests/test_access_control.py
from .util import live_server_setup, wait_for_all_checks from flask import url_for import time def test_check_access_control(app, client, live_server, measure_memory_usage, datastore_path): # Still doesnt work, but this is closer. # live_server_setup(live_server) # Setup on conftest per function with app....
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_unique_lines.py
changedetectionio/tests/test_unique_lines.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup, wait_for_all_checks, delete_all_watches import os def set_original_ignore_response(datastore_path): test_return_data = """<html> <body> <p>Some initial text</p> <p>Which is across multiple lines</p> ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_xpath_selector.py
changedetectionio/tests/test_xpath_selector.py
# -*- coding: utf-8 -*- from flask import url_for from .util import wait_for_all_checks, delete_all_watches from ..processors.magic import RSS_XML_CONTENT_TYPES import os def set_rss_atom_feed_response(datastore_path, header='', ): test_return_data = f"""{header}<!-- Generated on Wed, 08 Oct 2025 08:42:33 -070...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_ignorestatuscode.py
changedetectionio/tests/test_ignorestatuscode.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup, wait_for_all_checks import os def set_original_response(datastore_path): test_return_data = """<html> <body> Some initial text<br> <p>Which is across multiple lines</p> <br> So let's se...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_source.py
changedetectionio/tests/test_source.py
#!/usr/bin/env python3 import time from flask import url_for from urllib.request import urlopen from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks from ..diff import ADDED_STYLE sleep_time_for_fetch_thread = 3 def test_check_basic_change_detection_functionality_sou...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_rss_reader_mode.py
changedetectionio/tests/test_rss_reader_mode.py
#!/usr/bin/env python3 import time import os from flask import url_for from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks, extract_rss_token_from_UI, \ extract_UUID_from_client, delete_all_watches def set_xmlns_purl_content(datastore_path, extra=""): data=f...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_xpath_default_namespace.py
changedetectionio/tests/test_xpath_default_namespace.py
#!/usr/bin/env python3 """ Unit tests for XPath default namespace handling in RSS/Atom feeds. Tests the fix for issue where //title/text() returns empty on feeds with default namespaces. Real-world test data from https://github.com/microsoft/PowerToys/releases.atom """ import sys import os import pytest sys.path.ins...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_request.py
changedetectionio/tests/test_request.py
import json import os import time from flask import url_for from . util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks, extract_UUID_from_client, delete_all_watches # Hard to just add more live server URLs when one test is already running (I think) # So we add our test he...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_preview_endpoints.py
changedetectionio/tests/test_preview_endpoints.py
#!/usr/bin/env python3 import time from flask import url_for from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks import os # `subtractive_selectors` should still work in `source:` type requests def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_trigger_regex_with_filter.py
changedetectionio/tests/test_trigger_regex_with_filter.py
#!/usr/bin/env python3 import time from flask import url_for from . util import live_server_setup, delete_all_watches import os def set_original_ignore_response(datastore_path): test_return_data = """<html> <body> Some initial text<br> <p>Which is across multiple lines</p> <br> So let'...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_xpath_selector_unit.py
changedetectionio/tests/test_xpath_selector_unit.py
import sys import os import pytest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import html_tools # test generation guide. # 1. Do not include encoding in the xml declaration if the test object is a str type. # 2. Always paraphrase test. hotels = """ <hotel> <branch location="Cali...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_obfuscations.py
changedetectionio/tests/test_obfuscations.py
#!/usr/bin/env python3 import time from flask import url_for from .util import live_server_setup import os def set_original_ignore_response(datastore_path): test_return_data = """<html> <body> <span>The price is</span><span>$<!-- -->90<!-- -->.<!-- -->74</span> </body> </html> """ ...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_pdf.py
changedetectionio/tests/test_pdf.py
#!/usr/bin/env python3 import time from flask import url_for from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks import os # `subtractive_selectors` should still work in `source:` type requests def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_jsonpath_jq_selector.py
changedetectionio/tests/test_jsonpath_jq_selector.py
#!/usr/bin/env python3 # coding=utf-8 import time from flask import url_for from markupsafe import escape from . util import live_server_setup, wait_for_all_checks, delete_all_watches import pytest import os jq_support = True try: import jq except ModuleNotFoundError: jq_support = False def test_unittest_i...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false
dgtlmoon/changedetection.io
https://github.com/dgtlmoon/changedetection.io/blob/0cb98229d67aa1203e745df586deb46834831859/changedetectionio/tests/test_html_to_text.py
changedetectionio/tests/test_html_to_text.py
#!/usr/bin/env python3 """Test suite for the method to extract text from an html string""" from ..html_tools import html_to_text def test_html_to_text_func(): test_html = """<html> <body> Some initial text<br> <p>Which is across multiple lines</p> <a href="/first_link"> More Text </a> <...
python
Apache-2.0
0cb98229d67aa1203e745df586deb46834831859
2026-01-04T14:43:28.546632Z
false