uf.webhooks#
Webhook support for uf.
Provides functionality to trigger HTTP callbacks when functions complete, enabling integration with external services.
Functions
Get the global webhook manager. |
|
|
Set the global webhook manager. |
|
Decorator to add webhooks to a function. |
Classes
|
Client for sending webhooks. |
|
Represents a webhook event. |
Manage webhooks for multiple URLs and events. |
- class uf.webhooks.WebhookClient(url, headers=None, timeout=10.0, retry_count=3)[source]#
Bases:
objectClient for sending webhooks.
Example
>>> client = WebhookClient('https://example.com/webhook') >>> client.send(WebhookEvent('success', 'my_func', {}, result=42))
- send(event, async_send=True)[source]#
Send a webhook event.
- Parameters:
event (
WebhookEvent) – WebhookEvent to sendasync_send (
bool) – Whether to send asynchronously
- Return type:
- Returns:
True if sent successfully (for sync sends)
- class uf.webhooks.WebhookEvent(event_type, func_name, params, result=None, error=None)[source]#
Bases:
objectRepresents a webhook event.
- event_type#
Type of event (‘success’, ‘failure’, ‘start’)
- func_name#
Name of the function
- params#
Function parameters
- result#
Function result (if success)
- error#
Error message (if failure)
- timestamp#
When event occurred
- class uf.webhooks.WebhookManager[source]#
Bases:
objectManage webhooks for multiple URLs and events.
Example
>>> manager = WebhookManager() >>> manager.add_webhook('https://example.com/hook1', events=['success']) >>> manager.add_webhook('https://example.com/hook2', events=['failure']) >>> manager.trigger('success', 'my_func', {}, result=42)
- uf.webhooks.set_global_webhook_manager(manager)[source]#
Set the global webhook manager.
- Return type: