MCPcopy
hub / github.com/httpie/cli / __init__

Method __init__

httpie/output/streams.py:115–136  ·  view source on GitHub ↗
(
        self,
        env=Environment(),
        mime_overwrite: str = None,
        encoding_overwrite: str = None,
        **kwargs
    )

Source from the content-addressed store, hash-verified

113 CHUNK_SIZE = 1
114
115 def __init__(
116 self,
117 env=Environment(),
118 mime_overwrite: str = None,
119 encoding_overwrite: str = None,
120 **kwargs
121 ):
122 super().__init__(**kwargs)
123 if mime_overwrite:
124 self.mime = mime_overwrite
125 else:
126 self.mime, _ = parse_content_type_header(self.msg.content_type)
127 self._encoding = encoding_overwrite or self.msg.encoding
128 self._encoding_guesses = []
129 if env.stdout_isatty:
130 # Use the encoding supported by the terminal.
131 output_encoding = env.stdout_encoding
132 else:
133 # Preserve the message encoding.
134 output_encoding = self.msg.encoding
135 # Default to UTF-8 when unsure.
136 self.output_encoding = output_encoding or UTF8
137
138 def iter_body(self) -> Iterable[bytes]:
139 for line, lf in self.msg.iter_lines(self.CHUNK_SIZE):

Callers

nothing calls this directly

Calls 3

EnvironmentClass · 0.50
__init__Method · 0.45

Tested by

no test coverage detected