MCPcopy
hub / github.com/urllib3/urllib3 / _init_decoder

Method _init_decoder

src/urllib3/response.py:600–617  ·  src/urllib3/response.py::BaseHTTPResponse._init_decoder

Set-up the _decoder attribute if necessary.

(self)

Source from the content-addressed store, hash-verified

598 raise NotImplementedError()
599
600 def _init_decoder(self) -> None:
601 class="st">"""
602 Set-up the _decoder attribute if necessary.
603 class="st">"""
604 class="cm"># Note: content-encoding value should be case-insensitive, per RFC 7230
605 class="cm"># Section 3.2
606 content_encoding = self.headers.get(class="st">"content-encoding", class="st">"").lower()
607 if self._decoder is None:
608 if content_encoding in self.CONTENT_DECODERS:
609 self._decoder = _get_decoder(content_encoding)
610 elif class="st">"," in content_encoding:
611 encodings = [
612 e.strip()
613 for e in content_encoding.split(class="st">",")
614 if e.strip() in self.CONTENT_DECODERS
615 ]
616 if encodings:
617 self._decoder = _get_decoder(content_encoding)
618
619 def _decode(
620 self,

Calls 2

_get_decoderFunction · 0.85
getMethod · 0.80