MCPcopy Index your code
hub / github.com/python/cpython / get_charsets

Method get_charsets

Lib/email/message.py:955–971  ·  view source on GitHub ↗

Return a list containing the charset(s) used in this message. The returned list of items describes the Content-Type headers' charset parameter for this message and all the subparts in its payload. Each item will either be a string (the value of the charset parameter

(self, failobj=None)

Source from the content-addressed store, hash-verified

953 return charset.lower()
954
955 def get_charsets(self, failobj=None):
956 """Return a list containing the charset(s) used in this message.
957
958 The returned list of items describes the Content-Type headers'
959 charset parameter for this message and all the subparts in its
960 payload.
961
962 Each item will either be a string (the value of the charset parameter
963 in the Content-Type header of that part) or the value of the
964 'failobj' parameter (defaults to None), if the part does not have a
965 main MIME type of "text", or the charset is not defined.
966
967 The list will contain one string for each part of the message, plus
968 one for the container message (i.e. self), so that a non-multipart
969 message will still return a list of length 1.
970 """
971 return [part.get_content_charset(failobj) for part in self.walk()]
972
973 def get_content_disposition(self):
974 """Return the message's content-disposition if it exists, or None.

Calls 2

get_content_charsetMethod · 0.80
walkMethod · 0.45