easyfilewatcher package
Subpackages
Submodules
easyfilewatcher.EasyFileWatcher module
- class easyfilewatcher.EasyFileWatcher.EasyFileWatcher(jobstore: Optional[str] = None)[source]
Bases:
object- add_directory_to_watch(directory_path: str, callback: function, start_date: Optional[datetime] = datetime.datetime(2022, 12, 7, 20, 8, 54, 522934), end_date: Optional[datetime] = None, callback_param: Optional[dict] = None, directory_watcher_id: Optional[str] = None, event_on_deletion: Optional[bool] = True, polling_time: Optional[int] = 2) None[source]
This method registers the directory of interest to watch. It further requires the function signature. Parameters to the function can be passed as a dictionary. Passing a directory_watcher_id is highly recommended as it can be used to delete a certain FileWatcher.
- param str directory_path
path of directory to watch
- param func callback
custom user to function to be executed at change in directory
- param Optional[dict] callback_param
parameters to be passed to callback function
- param Optional[str] directory_watcher_id
assigned ID of watcher
- param Optional[bool] event_on_deletion
shall an event be triggered at deletion of File
- param Optional[datetime] start_date
When shall File Watcher starts tracking
- param Optional[datetime] end_date
When shall File Watcher end tracking
- param Optional[int] polling_time
Interval Watcher checks on specified directory
- returns
List of EasyFileWatcherUnits
- rtype
List[EasyFileWatcherUnit]
- delete_easy_file_watcher(directory_watcher_id) bool[source]
This method deletes an EasyFileWatcher. It returns True at success and False at failure. :returns: None :rtype: None
- static execute_job(*args)[source]
This method executes the call back of the directory of interest to watch.
- get_directory_watcher_jobs() list[source]
This method return a list of current EasyFileWatcher Jobs. Good way to retrieve DirectoryWatcherID if not initially provided. :returns: list of EasyFileWatcher Jobs :rtype: list