Three new hooks (plugin API 0.7.0), so features like OAuth 2.0 client credentials (#375), HMAC signing or rotating API keys can live in plugins instead of core: - fetch_request_alter: change headers, method and body just before the fetch; gets the check's proxy URL. Exceptions fail the check rather than sending the request without what the plugin meant to add. - ui_edit_request_settings: a plugin's WTForms form nested into the edit page's Request tab under "Show advanced options", validated with the page, saved to {watch data dir}/{plugin_id}.json, never the watch itself. - watch_settings_files: files "Clear history" keeps, beside the processors' {processor}.json. plugin_api exports load_watch_plugin_settings / save_watch_plugin_settings. Adds the request/api_key_header example plugin, which uses all three. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Change detection post-processors
The concept here is to be able to switch between different domain specific problems to solve.
text_json_diffThe traditional text and JSON comparison handlerrestock_diffOnly cares about detecting if a product looks like it has some text that suggests that it's out of stock, otherwise assumes that it's in stock.
Some suggestions for the future
graphical
API schema extension (api.yaml)
A processor can extend the Watch/Tag API schema by placing an api.yaml alongside its __init__.py.
Define a components.schemas.processor_config_<name> entry and it will be merged into WatchBase at startup,
making processor_config_<name> a valid field on all watch create/update API calls.
The fully merged spec is served live at /api/v1/full-spec.
See restock_diff/api.yaml for a working example.
Processor plugin hooks (register_plugin_hooks)
A processor can add its own plugin hooks: define register_plugin_hooks(plugin_manager) in its __init__.py
and it's called once at startup. Add your hookspecs there, and register built-in implementations with
trylast=True so any other plugin's implementation wins. restock_diff does this for its two price charts,
see restock_diff/hookspecs.py and restock_diff/plugins/default_charts.py.
Todo
- Make each processor return a extra list of sub-processed (so you could configure a single processor in different ways)
- move restock_diff to its own pip/github repo