data-collection/email/emlx_parser.py
def parse(self):
        """return the data structure for the current emlx file
        * an email object
        * the plist structure as a dict data structure
        """
        with open(self.filename, "r", errors='ignore') as f:
            # extract the bytecount
            content = f.readlines()

        if content:
            t = open(self.filename, "rb")
            self.bytecount = int(t.readline().strip())
            # parse du mail
            self.email = email.message_from_bytes(t.read(self.bytecount))

        for part in self.email.walk():
            if part.get_content_type() == 'text/plain':
                self.txt = part.get_payload()

            elif part.get_content_type() == "text/html":
                self.html = part.get_payload()
                self.html2txt = html2text.html2text(part.get_payload())

        return self.email
return the data structure for the current emlx file
        * an email object
        * the plist structure as a dict data structure
        
return the data structure for the current emlx file
an email object
the plist structure as a dict data structure
return the data structure for the current emlx file an email object the plist structure as a dict data structure
def parse(self):
        with open(self.filename, "r", errors='ignore') as f:
            content = f.readlines()
        if content:
            t = open(self.filename, "rb")
            self.bytecount = int(t.readline().strip())
            self.email = email.message_from_bytes(t.read(self.bytecount))
        for part in self.email.walk():
            if part.get_content_type() == 'text/plain':
                self.txt = part.get_payload()
            elif part.get_content_type() == "text/html":
                self.html = part.get_payload()
                self.html2txt = html2text.html2text(part.get_payload())
        return self.email
def parse ( self ) : with open ( self . filename , "r" , errors = 'ignore' ) as f : content = f . readlines ( ) if content : t = open ( self . filename , "rb" ) self . bytecount = int ( t . readline ( ) . strip ( ) ) self . email = email . message_from_bytes ( t . read ( self . bytecount ) ) for part in self . email . walk ( ) : if part . get_content_type ( ) == 'text/plain' : self . txt = part . get_payload ( ) elif part . get_content_type ( ) == "text/html" : self . html = part . get_payload ( ) self . html2txt = html2text . html2text ( part . get_payload ( ) ) return self . email
return the data structure for the current emlx file
 an email object
 the plist structure as a dict data structure
return the data structure for the current emlx file an email object the plist structure as a dict data structure
"""return the data structure for the current emlx file
        * an email object
        * the plist structure as a dict data structure
        """ # extract the bytecount # parse du mail
self