| Current File : /home/mmdealscpanel/yummmdeals.com/mime.tar |
message.py 0000644 00000002406 15052440455 0006550 0 ustar 00 # Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Class representing message/* MIME documents."""
__all__ = ['MIMEMessage']
from email import message
from email.mime.nonmultipart import MIMENonMultipart
class MIMEMessage(MIMENonMultipart):
"""Class representing message/* MIME documents."""
def __init__(self, _msg, _subtype='rfc822'):
"""Create a message/* type MIME document.
_msg is a message object and must be an instance of Message, or a
derived class of Message, otherwise a TypeError is raised.
Optional _subtype defines the subtype of the contained message. The
default is "rfc822" (this is defined by the MIME standard, even though
the term "rfc822" is technically outdated by RFC 2822).
"""
MIMENonMultipart.__init__(self, 'message', _subtype)
if not isinstance(_msg, message.Message):
raise TypeError('Argument is not an instance of Message')
# It's convenient to use this base class method. We need to do it
# this way or we'll get an exception
message.Message.attach(self, _msg)
# And be sure our default type is set correctly
self.set_default_type('message/rfc822')
__init__.py 0000644 00000000000 15052440455 0006647 0 ustar 00 image.py 0000644 00000003344 15052440455 0006210 0 ustar 00 # Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Class representing image/* type MIME documents."""
__all__ = ['MIMEImage']
import imghdr
from email import encoders
from email.mime.nonmultipart import MIMENonMultipart
class MIMEImage(MIMENonMultipart):
"""Class for generating image/* type MIME documents."""
def __init__(self, _imagedata, _subtype=None,
_encoder=encoders.encode_base64, **_params):
"""Create an image/* type MIME document.
_imagedata is a string containing the raw image data. If this data
can be decoded by the standard Python `imghdr' module, then the
subtype will be automatically included in the Content-Type header.
Otherwise, you can specify the specific image subtype via the _subtype
parameter.
_encoder is a function which will perform the actual encoding for
transport of the image data. It takes one argument, which is this
Image instance. It should use get_payload() and set_payload() to
change the payload to the encoded form. It should also add any
Content-Transfer-Encoding or other headers to the message as
necessary. The default encoding is Base64.
Any additional keyword arguments are passed to the base class
constructor, which turns them into parameters on the Content-Type
header.
"""
if _subtype is None:
_subtype = imghdr.what(None, _imagedata)
if _subtype is None:
raise TypeError('Could not guess image MIME subtype')
MIMENonMultipart.__init__(self, 'image', _subtype, **_params)
self.set_payload(_imagedata)
_encoder(self)
nonmultipart.py 0000644 00000001263 15052440455 0007660 0 ustar 00 # Copyright (C) 2002-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Base class for MIME type messages that are not multipart."""
__all__ = ['MIMENonMultipart']
from email import errors
from email.mime.base import MIMEBase
class MIMENonMultipart(MIMEBase):
"""Base class for MIME non-multipart type messages."""
def attach(self, payload):
# The public API prohibits attaching multiple subparts to MIMEBase
# derived subtypes since none of them are, by definition, of content
# type multipart/*
raise errors.MultipartConversionError(
'Cannot attach additional subparts to non-multipart/*')
__pycache__/text.cpython-38.opt-2.pyc 0000644 00000001442 15052440456 0013336 0 ustar 00 U
e5d� � @ s2 d gZ ddlmZ ddlmZ G dd � d e�ZdS )�MIMEText� )�Charset)�MIMENonMultipartc @ s e Zd Zddd�dd�ZdS )r �plainN)�policyc C sf |d kr4z|� d� d}W n tk
r2 d}Y nX tj| d|fd|idt|�i�� | �||� d S )Nzus-asciizutf-8�textr �charset)�encode�UnicodeEncodeErrorr �__init__�strZset_payload)�selfZ_textZ_subtypeZ_charsetr � r �'/usr/lib64/python3.8/email/mime/text.pyr s
�zMIMEText.__init__)r N)�__name__�
__module__�__qualname__r r r r r r s N)�__all__Z
email.charsetr Zemail.mime.nonmultipartr r r r r r �<module> s __pycache__/base.cpython-38.pyc 0000644 00000002023 15052440456 0012320 0 ustar 00 U
e5d� � @ s4 d Z dgZddlZddlmZ G dd� dej�ZdS )�$Base class for MIME specializations.�MIMEBase� N)�messagec @ s e Zd ZdZdd�dd�ZdS )r r N��policyc K sH |dkrt jj}tjj| |d� d||f }| jd|f|� d| d<