webmentions.storage.adapters.file package
Module contents
- class webmentions.storage.adapters.file.ContentChange(change_type: ContentChangeType, path: str, text: str | None, text_format: ContentTextFormat | None)[source]
Bases:
objectContent change model.
- change_type: ContentChangeType
- path: str
- text: str | None
- text_format: ContentTextFormat | None
- class webmentions.storage.adapters.file.ContentChangeType(value)[source]
Bases:
str,EnumContent change types.
- ADDED = 'added'
- DELETED = 'deleted'
- EDITED = 'edited'
- class webmentions.storage.adapters.file.FileSystemMonitor(handler: WebmentionsHandler, root_dir: str, file_to_url_mapper: Callable[[str], str], *, extensions: tuple[str, ...] = ('.md', '.markdown', '.txt', '.html', '.htm'), throttle_seconds: float = 2.0)[source]
Bases:
objectEncapsulates
FilesystemWatcherto watch a directory for changes to files and maps file system events to outgoing Webmention requests.- Parameters:
handler – The Webmentions handler to use to dispatch outgoing Webmentions.
root_dir – The root directory to watch.
file_to_url_mapper – A function that maps file paths to URLs to be used in outgoing Webmentions.
extensions – A tuple of file extensions to watch. Default: all text, HTML, and Markdown files.
throttle_seconds – The minimum number of seconds between processing changes, to prevent too many consecutive calls when a file is written multiple times. Default: 2.