Mercurial > repos > rliterman > csp2
annotate 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 |
rev | line source |
---|---|
jpayne@68 | 1 # Copyright (C) 2001-2006 Python Software Foundation |
jpayne@68 | 2 # Author: Keith Dart |
jpayne@68 | 3 # Contact: email-sig@python.org |
jpayne@68 | 4 |
jpayne@68 | 5 """Class representing application/* type MIME documents.""" |
jpayne@68 | 6 |
jpayne@68 | 7 __all__ = ["MIMEApplication"] |
jpayne@68 | 8 |
jpayne@68 | 9 from email import encoders |
jpayne@68 | 10 from email.mime.nonmultipart import MIMENonMultipart |
jpayne@68 | 11 |
jpayne@68 | 12 |
jpayne@68 | 13 class MIMEApplication(MIMENonMultipart): |
jpayne@68 | 14 """Class for generating application/* MIME documents.""" |
jpayne@68 | 15 |
jpayne@68 | 16 def __init__(self, _data, _subtype='octet-stream', |
jpayne@68 | 17 _encoder=encoders.encode_base64, *, policy=None, **_params): |
jpayne@68 | 18 """Create an application/* type MIME document. |
jpayne@68 | 19 |
jpayne@68 | 20 _data is a string containing the raw application data. |
jpayne@68 | 21 |
jpayne@68 | 22 _subtype is the MIME content type subtype, defaulting to |
jpayne@68 | 23 'octet-stream'. |
jpayne@68 | 24 |
jpayne@68 | 25 _encoder is a function which will perform the actual encoding for |
jpayne@68 | 26 transport of the application data, defaulting to base64 encoding. |
jpayne@68 | 27 |
jpayne@68 | 28 Any additional keyword arguments are passed to the base class |
jpayne@68 | 29 constructor, which turns them into parameters on the Content-Type |
jpayne@68 | 30 header. |
jpayne@68 | 31 """ |
jpayne@68 | 32 if _subtype is None: |
jpayne@68 | 33 raise TypeError('Invalid application MIME subtype') |
jpayne@68 | 34 MIMENonMultipart.__init__(self, 'application', _subtype, policy=policy, |
jpayne@68 | 35 **_params) |
jpayne@68 | 36 self.set_payload(_data) |
jpayne@68 | 37 _encoder(self) |