aidputils.agents.tools.http.parsers

Response parsers for HTTP Tool.

class aidputils.agents.tools.http.parsers.ResponseParser[source]

Bases: ABC

Base class for response parsers.

abstractmethod classmethod content_types() List[str][source]

Return list of content-types this parser handles.

Examples: [‘application/json’], [‘text/html’], [‘text/plain’, ‘/’]

Returns:

List of content-type strings (may include wildcards)

abstractmethod parse(raw_data: Any, headers: Dict[str, str]) Any[source]

Parse raw response data into structured format.

Parameters:
  • raw_data – Raw response data from HTTP client

  • headers – Response headers dict

Returns:

Parsed response (dict for JSON, string for text/html, etc.)

abstractmethod get_response_type() str[source]

Return the response type identifier.

Used for optimizer selection (e.g., ‘json’, ‘html’, ‘text’).

Returns:

Response type string

Submodules