Share via


HttpPlugin Class

A plugin that provides HTTP functionality.

Usage: kernel.add_plugin(HttpPlugin(), "http")

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Constructor

HttpPlugin()

Examples

{{http.getAsync $url}} {{http.postAsync $url}} {{http.putAsync $url}} {{http.deleteAsync $url}}

Methods

delete

Sends an HTTP DELETE request to the specified URI and returns the response body as a string.

get

Sends an HTTP GET request to the specified URI and returns the response body as a string.

post

Sends an HTTP POST request to the specified URI and returns the response body as a string.

put

Sends an HTTP PUT request to the specified URI and returns the response body as a string.

delete

Sends an HTTP DELETE request to the specified URI and returns the response body as a string.

async delete(url: Annotated[str, 'The URI to send the request to.']) -> str

Parameters

Name Description
url
Required

The URI to send the request to.

Returns

Type Description

The response body as a string.

get

Sends an HTTP GET request to the specified URI and returns the response body as a string.

async get(url: Annotated[str, 'The URL to send the request to.']) -> str

Parameters

Name Description
url
Required

The URL to send the request to.

Returns

Type Description

The response body as a string.

post

Sends an HTTP POST request to the specified URI and returns the response body as a string.

async post(url: Annotated[str, 'The URI to send the request to.'], body: Annotated[dict[str, Any] | None, 'The body of the request'] = {}) -> str

Parameters

Name Description
url
Required

The URI to send the request to.

body

Contains the body of the request

Default value: {}

Returns

Type Description

The response body as a string.

put

Sends an HTTP PUT request to the specified URI and returns the response body as a string.

async put(url: Annotated[str, 'The URI to send the request to.'], body: Annotated[dict[str, Any] | None, 'The body of the request'] = {}) -> str

Parameters

Name Description
url
Required

The URI to send the request to.

body

Contains the body of the request

Default value: {}

Returns

Type Description

The response body as a string.