Webhooks Client

class WebhooksClient(url: str, max_concurrency: int = 10)

A client for simulating webhooks to an HTTP server.

Parameters:
  • url (str) – The full URL the client will send webhooks to. Include the scheme, port, and path.

  • max_concurrency (int) – The maximum number of connections the client will make when sending webhooks to the given URL (defaults to 10).

send_webhook(webhook: WebhookModel) Response

Send a single webhook in an HTTP POST request to the configured URL.

Parameters:

webhook (WebhookModel) – The webhook object that will be serialized to JSON.

Returns:

Requests Response object

Return type:

requests.Response

fire(webhook: Type[WebhookModel], count: int = 1) Iterator[Response]

Send one or more randomized webhooks to the configured URL using a webhook model. This method will automatically make the requests concurrently up to the configured max concurrency.

Parameters:
  • webhook (Type[webhooks.WebhookModel]) – A webhook model. This must be the type and not an instantiated object.

  • count (int) – The number of webhook events to send (defaults to 1).

Returns:

An iterator that will yield Requests Response object objects.

Return type:

Iterator[requests.Response]