magpie.api.webhooks
¶
Module Contents¶
Classes¶
Actions supported by webhooks. |
Functions¶
|
Checks the config for any webhooks that correspond to the input action, and prepares corresponding requests. |
|
Replace each template parameter from the payload by its corresponding value. |
|
Sends a single webhook request using the input config. |
|
Updates the user’s status to indicate an error occured with the webhook requests. |
-
class
magpie.api.webhooks.
WebhookAction
[source]¶ Bases:
magpie.utils.ExtendedEnum
Actions supported by webhooks.
-
magpie.api.webhooks.
process_webhook_requests
(action, params, update_user_status_on_error=False)[source]¶ Checks the config for any webhooks that correspond to the input action, and prepares corresponding requests.
- Parameters
action – tag identifying which webhooks to use in the config
params – dictionary containing the required parameters for the request, they will replace templates found in the payload
update_user_status_on_error – update the user status or not in case of a webhook error
-
magpie.api.webhooks.
replace_template
(params, payload)[source]¶ Replace each template parameter from the payload by its corresponding value.
- Parameters
params – the values of the template parameters
payload – structure containing the data to be processed by the template replacement
- Returns
structure containing the data with the replaced template parameters
-
magpie.api.webhooks.
send_webhook_request
(webhook_config, params, update_user_status_on_error=False)[source]¶ Sends a single webhook request using the input config.
- Parameters
webhook_config – dictionary containing the config data of a single webhook
params – dictionary containing the required parameters for the request, they will replace templates found in the payload
update_user_status_on_error – update the user status or not in case of a webhook error