NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

image.py (678B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\stdlib\email\mime\image.py
      2 __all__ = ['MIMEImage']
      3 import imghdr
      4 from email import encoders
      5 from email.mime.nonmultipart import MIMENonMultipart
      6 
      7 class MIMEImage(MIMENonMultipart):
      8 
      9     def __init__(self, _imagedata, _subtype = None, _encoder = encoders.encode_base64, **_params):
     10         if _subtype is None:
     11             _subtype = imghdr.what(None, _imagedata)
     12         if _subtype is None:
     13             raise TypeError('Could not guess image MIME subtype')
     14         MIMENonMultipart.__init__(self, 'image', _subtype, **_params)
     15         self.set_payload(_imagedata)
     16         _encoder(self)