MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_param

Method get_param

tools/python-3.11.9-amd64/Lib/email/message.py:695–727  ·  view source on GitHub ↗

Return the parameter value if found in the Content-Type header. Optional failobj is the object to return if there is no Content-Type header, or the Content-Type header has no such parameter. Optional header is the header to search instead of Content-Type. Par

(self, param, failobj=None, header='content-type',
                  unquote=True)

Source from the content-addressed store, hash-verified

693 return params
694
695 def get_param(self, param, failobj=None, header='content-type',
696 unquote=True):
697 """Return the parameter value if found in the Content-Type header.
698
699 Optional failobj is the object to return if there is no Content-Type
700 header, or the Content-Type header has no such parameter. Optional
701 header is the header to search instead of Content-Type.
702
703 Parameter keys are always compared case insensitively. The return
704 value can either be a string, or a 3-tuple if the parameter was RFC
705 2231 encoded. When it's a 3-tuple, the elements of the value are of
706 the form (CHARSET, LANGUAGE, VALUE). Note that both CHARSET and
707 LANGUAGE can be None, in which case you should consider VALUE to be
708 encoded in the us-ascii charset. You can usually ignore LANGUAGE.
709 The parameter value (either the returned string, or the VALUE item in
710 the 3-tuple) is always unquoted, unless unquote is set to False.
711
712 If your application doesn't care whether the parameter was RFC 2231
713 encoded, it can turn the return value into a string as follows:
714
715 rawparam = msg.get_param('foo')
716 param = email.utils.collapse_rfc2231_value(rawparam)
717
718 """
719 if header not in self:
720 return failobj
721 for k, v in self._get_params_preserve(failobj, header):
722 if k.lower() == param.lower():
723 if unquote:
724 return _unquotevalue(v)
725 else:
726 return v
727 return failobj
728
729 def set_param(self, param, value, header='Content-Type', requote=True,
730 charset=None, language='', replace=False):

Callers 13

get_payloadMethod · 0.95
set_paramMethod · 0.95
get_filenameMethod · 0.95
get_boundaryMethod · 0.95
get_content_charsetMethod · 0.95
_download_classifiersFunction · 0.95
_find_bodyMethod · 0.80
iter_attachmentsMethod · 0.80
_handle_textMethod · 0.80
get_text_contentFunction · 0.80

Calls 3

_get_params_preserveMethod · 0.95
_unquotevalueFunction · 0.85
lowerMethod · 0.45

Tested by

no test coverage detected