classWebhook(Block):""" Block that enables calling webhooks. """_block_type_name="Webhook"_logo_url="https://cdn.sanity.io/images/3ugk85nk/production/c7247cb359eb6cf276734d4b1fbf00fb8930e89e-250x250.png"# type: ignore_documentation_url="https://docs.prefect.io/api-ref/prefect/blocks/webhook/#prefect.blocks.webhook.Webhook"method:Literal["GET","POST","PUT","PATCH","DELETE"]=Field(default="POST",description="The webhook request method. Defaults to `POST`.")url:SecretStr=Field(default=...,title="Webhook URL",description="The webhook URL.",examples=["https://hooks.slack.com/XXX"],)headers:SecretDict=Field(default_factory=lambda:SecretDict(dict()),title="Webhook Headers",description="A dictionary of headers to send with the webhook request.",)defblock_initialization(self):self._client=AsyncClient(transport=_http_transport)asyncdefcall(self,payload:Optional[dict]=None)->Response:""" Call the webhook. Args: payload: an optional payload to send when calling the webhook. """asyncwithself._client:returnawaitself._client.request(method=self.method,url=self.url.get_secret_value(),headers=self.headers.get_secret_value(),json=payload,)
an optional payload to send when calling the webhook.
None
Source code in src/prefect/blocks/webhook.py
5152535455565758596061626364
asyncdefcall(self,payload:Optional[dict]=None)->Response:""" Call the webhook. Args: payload: an optional payload to send when calling the webhook. """asyncwithself._client:returnawaitself._client.request(method=self.method,url=self.url.get_secret_value(),headers=self.headers.get_secret_value(),json=payload,)