2018년 6월 20일 수요일

python decode mime

import email
import base64

def decode_mime(_msg, _result=[]):
    def _decode(msg, result):
        if msg.is_multipart():
            for item in msg.get_payload():
                _decode(item, result)
        else:
            if 'content-type' in msg:
                _content_type = msg['content-type']
                if 'text/html' in _content_type:
                    decoded_text = base64.decodestring(msg.get_payload())
                    result.append(decoded_text)
    _decode(_msg, _result)

decode_mime(email.message_from_string(_message), result=[])

댓글 없음:

댓글 쓰기

docker redmine 설치

docker-composer.yml version: '3.1' services:      redmine:           image: redmine           restart: always           container_na...