animedex.render.raw
Four output renderers for RawResponse.
Per #3 §5.0:
render_body()- default, body text only (gh api equivalent).render_include()--i, curl-style status + headers + body.render_head()--I, status + headers only.render_debug()---debug, structured JSON envelope.
The CLI in animedex.entry.cli picks one of these based on the
mutually-exclusive output flags.
render_body
- animedex.render.raw.render_body(envelope: RawResponse) str[source]
Default mode: print the response body as text.
Returns
body_textwhen it decoded as UTF-8; otherwise base64- encodesbody_bytesso the output is still printable. Callers that need the raw bytes for binary content should use the library API (animedex.api.call) instead of the CLI.- Parameters:
envelope (RawResponse) – The response envelope.
- Returns:
Body text (or base64-encoded bytes when not decodable).
- Return type:
render_include
- animedex.render.raw.render_include(envelope: RawResponse) str[source]
-imode: status line + response headers + blank + body.Mirrors
curl -ioutput. The header block uses the response’s own header casing as captured.- Parameters:
envelope (RawResponse) – The response envelope.
- Returns:
Status + headers + body, separated by blank line.
- Return type:
render_head
- animedex.render.raw.render_head(envelope: RawResponse) str[source]
-Imode: status line + response headers, no body.- Parameters:
envelope (RawResponse) – The response envelope.
- Returns:
Status + headers.
- Return type:
render_debug
- animedex.render.raw.render_debug(envelope: RawResponse, *, full_body: bool = False) str[source]
--debugmode: structured JSON envelope.Emits the entire
RawResponseas indented JSON. Body content is truncated to_DEBUG_BODY_CAP_BYTES(64 KiB) by default and tagged withbody_truncated_at_bytes; passfull_body=Trueto emit the full body verbatim. Binary bodies that did not decode as UTF-8 are base64-encoded inside the JSON.Credential headers in
request.headersare already redacted by the dispatcher (seeanimedex.api._envelope.redact_headers()); this renderer does not perform additional redaction.- Parameters:
envelope (RawResponse) – The response envelope.
full_body (bool) – When
True, do not truncate the body.
- Returns:
Indented JSON of the envelope.
- Return type: