Class for generating audio/* MIME documents.
| 11 | |
| 12 | |
| 13 | class 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 = [] |
no outgoing calls
searching dependent graphs…