Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/email/mime/application.py @ 68:5028fdace37b
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 16:23:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 68:5028fdace37b |
---|---|
1 # Copyright (C) 2001-2006 Python Software Foundation | |
2 # Author: Keith Dart | |
3 # Contact: email-sig@python.org | |
4 | |
5 """Class representing application/* type MIME documents.""" | |
6 | |
7 __all__ = ["MIMEApplication"] | |
8 | |
9 from email import encoders | |
10 from email.mime.nonmultipart import MIMENonMultipart | |
11 | |
12 | |
13 class MIMEApplication(MIMENonMultipart): | |
14 """Class for generating application/* MIME documents.""" | |
15 | |
16 def __init__(self, _data, _subtype='octet-stream', | |
17 _encoder=encoders.encode_base64, *, policy=None, **_params): | |
18 """Create an application/* type MIME document. | |
19 | |
20 _data is a string containing the raw application data. | |
21 | |
22 _subtype is the MIME content type subtype, defaulting to | |
23 'octet-stream'. | |
24 | |
25 _encoder is a function which will perform the actual encoding for | |
26 transport of the application data, defaulting to base64 encoding. | |
27 | |
28 Any additional keyword arguments are passed to the base class | |
29 constructor, which turns them into parameters on the Content-Type | |
30 header. | |
31 """ | |
32 if _subtype is None: | |
33 raise TypeError('Invalid application MIME subtype') | |
34 MIMENonMultipart.__init__(self, 'application', _subtype, policy=policy, | |
35 **_params) | |
36 self.set_payload(_data) | |
37 _encoder(self) |