Пример #1
0
 def walk_through_message(self, message, hash):
     success = False
     msg = email.message_from_string(message)
     counter = 1
     for part in msg.walk():
         contentType = part.get_content_type()
         
         # for now I need only jpeg images
         if contentType == 'image/jpeg':
             image = Image()
             decoded_image = part.get_payload(decode=True)
             image.image_blob = db.Blob(decoded_image)
             image.sha1_hash = hash
             image.filenumber = counter
             image.put()
             
             counter += 1
             # if we have jpeg images in .mht file it's right file
             success = True
     
     return success