MCPcopy
hub / github.com/scrapy/scrapy / to_unicode_dict

Method to_unicode_dict

scrapy/http/headers.py:115–125  ·  view source on GitHub ↗

Return headers as a CaseInsensitiveDict with str keys and str values. Multiple values are joined with ','.

(self)

Source from the content-addressed store, hash-verified

113 return headers_dict_to_raw(self)
114
115 def to_unicode_dict(self) -> CaseInsensitiveDict:
116 """Return headers as a CaseInsensitiveDict with str keys
117 and str values. Multiple values are joined with ','.
118 """
119 return CaseInsensitiveDict(
120 (
121 to_unicode(key, encoding=self.encoding),
122 to_unicode(b",".join(value), encoding=self.encoding),
123 )
124 for key, value in self.items()
125 )
126
127 def to_tuple_list(self) -> list[tuple[str, str]]:
128 """Return headers as a list of ``(key, value)`` tuples.

Callers 2

download_requestMethod · 0.80

Calls 4

itemsMethod · 0.95
CaseInsensitiveDictClass · 0.90
to_unicodeFunction · 0.90
joinMethod · 0.45

Tested by 1