Skip to content

HTTP Response Artifact

Structured model to represent an HTTP response from the requests library.


General Information:

Type ID Module Category
100 httplib artifact

HttpResponseArtifact

Parameters:

  • url: str, optional

Input Parameters:

Field Type Required Description Default value Examples
url Optional[str] Final URL requested, after redirects. None -
method Optional[str] HTTP method used to issue the request. None -
status_code Optional[int] HTTP status code returned by the server. None -
reason Optional[str] Reason phrase returned by the server. None -
ok Optional[bool] Whether the response was successful (status < 400). None -
elapsed Optional[float] Time in seconds that the request took to complete. None -
headers Optional[dict[str, str]] Response headers normalized to simple string pairs. None -
request_headers Optional[dict[str, str]] Headers that were sent with the HTTP request. None -
body Optional[Any] Response body limited by the server safeguards. None -
body_preview Optional[Any] Body processed for safe display (e.g. truncated lists). None -
encoding Optional[str] Encoding declared by the server for the response. None -
apparent_encoding Optional[str] Encoding detected heuristically by requests. None -
error Optional[str] Error message when the request failed. None -

Example:

{
  "url": "https://api.example.com/data",
  "method": "GET",
  "status_code": 200,
  "reason": "OK",
  "ok": true,
  "elapsed": 0.123,
  "headers": {
    "Content-Type": "application/json"
  },
  "request_headers": {
    "Authorization": "Bearer token"
  },
  "body": {
    "key": "value"
  },
  "body_preview": {
    "key": "value"
  },
  "encoding": "utf-8",
  "apparent_encoding": "utf-8",
  "error": null
}

Notes:

This model captures the key details of an HTTP response,