HTTPRequest#

class eclypse.remote.communication.rest.http_request.HTTPRequest[source]#

Bases: EclypseRequest

HTTPRequest class.

An HTTP request is used to send and receive data between services in the same application, using the REST communication protocol.

Methods

__init__(url, method, data, _rest)

Initializes an HTTPRequest object.

Attributes

body

Get the body of the response.

response

Get the response of the request.

route

Get the route of the request.

status_code

Get the status code of the response.

__init__(url, method, data, _rest)[source]#

Initializes an HTTPRequest object.

Parameters:
  • url (str) – The URL of the request.

  • method (HTTPMethod) – The HTTP method of the request.

  • data (dict[Any, Any]) – The data to send in the request.

  • _rest (EclypseREST) – The REST interface used to send the request.

property route: Route | None#

Get the route of the request.

Returns:

The route of the request.

Return type:

Route | None

property response: tuple[HTTPStatusCode, dict[str, Any]] | None#

Get the response of the request.

Returns:

The response of the request.

Return type:

tuple[HTTPStatusCode, dict[str, Any]]

property status_code: HTTPStatusCode#

Get the status code of the response.

Returns:

The status code of the response.

Return type:

HTTPStatusCode

Raises:

RuntimeError – If the request is not completed yet.

property body: dict[str, Any]#

Get the body of the response.

Returns:

The body of the response.

Return type:

dict[str, Any]

Raises:

RuntimeError – If the request is not completed yet.