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

Method _init_decoder

src/urllib3/response.py:600–617  ·  view source on GitHub ↗

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 """
602 Set-up the _decoder attribute if necessary.
603 """
604 # Note: content-encoding value should be case-insensitive, per RFC 7230
605 # Section 3.2
606 content_encoding = self.headers.get("content-encoding", "").lower()
607 if self._decoder is None:
608 if content_encoding in self.CONTENT_DECODERS:
609 self._decoder = _get_decoder(content_encoding)
610 elif "," in content_encoding:
611 encodings = [
612 e.strip()
613 for e in content_encoding.split(",")
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