application.hook
Module
Python and Lua scripting support.
See Plugin Scripting Hooks for an introduction.
-
class
wpull.application.hook.
Actions
[source]
Bases: enum.Enum
Actions for handling responses and errors.
-
NORMAL
normal
Use Wpull’s original behavior.
-
RETRY
retry
Retry this item (as if an error has occurred).
-
FINISH
finish
Consider this item as done; don’t do any further
processing on it.
-
STOP
stop
Raises HookStop
to stop the Engine from running.
-
class
wpull.application.hook.
EventDispatcher
[source]
Bases: collections.abc.Mapping
-
add_listener
(name: str, callback)[source]
-
is_registered
(name: str) → bool[source]
-
notify
(name: str, *args, **kwargs)[source]
-
register
(name: str)[source]
-
remove_listener
(name: str, callback)[source]
-
unregister
(name: str)[source]
-
exception
wpull.application.hook.
HookAlreadyConnectedError
[source]
Bases: ValueError
A callback is already connected to the hook.
-
exception
wpull.application.hook.
HookDisconnected
[source]
Bases: RuntimeError
No callback is connected.
-
class
wpull.application.hook.
HookDispatcher
(event_dispatcher_transclusion: typing.Union=None)[source]
Bases: collections.abc.Mapping
Dynamic callback hook system.
-
call
(name: str, *args, **kwargs)[source]
Invoke the callback.
-
call_async
(name: str, *args, **kwargs)[source]
Invoke the callback.
-
connect
(name, callback)[source]
Add callback to hook.
-
disconnect
(name: str)[source]
Remove callback from hook.
-
is_connected
(name: str) → bool[source]
Return whether the hook is connected.
-
is_registered
(name: str) → bool[source]
-
register
(name: str)[source]
Register hooks that can be connected.
-
unregister
(name: str)[source]
Unregister hook.
-
exception
wpull.application.hook.
HookStop
[source]
Bases: Exception
Stop the engine.
Raise this exception as a more graceful alternative to sys.exit()
.
-
class
wpull.application.hook.
HookableMixin
[source]
Bases: object
-
connect_plugin
(plugin: wpull.application.plugin.WpullPlugin)[source]