1 # Copyright (C) 2001-2006 Python Software Foundation
3 # Contact: email-sig@python.org
5 """Class representing application/* type MIME documents."""
7 __all__
= ["MIMEApplication"]
9 from email
import encoders
10 from email
.mime
.nonmultipart
import MIMENonMultipart
13 class MIMEApplication(MIMENonMultipart
):
14 """Class for generating application/* MIME documents."""
16 def __init__(self
, _data
, _subtype
='octet-stream',
17 _encoder
=encoders
.encode_base64
, **_params
):
18 """Create an application/* type MIME document.
20 _data is a string containing the raw applicatoin data.
22 _subtype is the MIME content type subtype, defaulting to
25 _encoder is a function which will perform the actual encoding for
26 transport of the application data, defaulting to base64 encoding.
28 Any additional keyword arguments are passed to the base class
29 constructor, which turns them into parameters on the Content-Type
33 raise TypeError('Invalid application MIME subtype')
34 MIMENonMultipart
.__init
__(self
, 'application', _subtype
, **_params
)
35 self
.set_payload(_data
)