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