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

Class MIMEAudio

Lib/email/mime/audio.py:13–45  ·  view source on GitHub ↗

Class for generating audio/* MIME documents.

Source from the content-addressed store, hash-verified

11
12
13class MIMEAudio(MIMENonMultipart):
14 """Class for generating audio/* MIME documents."""
15
16 def __init__(self, _audiodata, _subtype=None,
17 _encoder=encoders.encode_base64, *, policy=None, **_params):
18 """Create an audio/* type MIME document.
19
20 _audiodata contains the bytes for the raw audio data. If this data
21 can be decoded as au, wav, aiff, or aifc, then the
22 subtype will be automatically included in the Content-Type header.
23 Otherwise, you can specify the specific audio subtype via the
24 _subtype parameter. If _subtype is not given, and no subtype can be
25 guessed, a TypeError is raised.
26
27 _encoder is a function which will perform the actual encoding for
28 transport of the image data. It takes one argument, which is this
29 Image instance. It should use get_payload() and set_payload() to
30 change the payload to the encoded form. It should also add any
31 Content-Transfer-Encoding or other headers to the message as
32 necessary. The default encoding is Base64.
33
34 Any additional keyword arguments are passed to the base class
35 constructor, which turns them into parameters on the Content-Type
36 header.
37 """
38 if _subtype is None:
39 _subtype = _what(_audiodata)
40 if _subtype is None:
41 raise TypeError('Could not find audio MIME subtype')
42 MIMENonMultipart.__init__(self, 'audio', _subtype, policy=policy,
43 **_params)
44 self.set_payload(_audiodata)
45 _encoder(self)
46
47
48_rules = []

Callers 2

_make_audioMethod · 0.90
test_checkSetMinorMethod · 0.90

Calls

no outgoing calls

Tested by 2

_make_audioMethod · 0.72
test_checkSetMinorMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…