Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ImapLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
IMAP Library - a IMAP email testing library.
"""

from email import message_from_string
from email import message_from_bytes
from imaplib import IMAP4, IMAP4_SSL
from re import findall
from time import sleep, time
Expand Down Expand Up @@ -248,7 +248,7 @@ def open_link_from_email(self, email_index, link_index=0):

if len(urls) > link_index:
resp = urlopen(urls[link_index])
content_type = resp.headers.getheader('content-type')
content_type = resp.headers.get('content-type')
if content_type:
enc = content_type.split('charset=')[-1]
return ustr(resp.read(), enc)
Expand Down Expand Up @@ -342,7 +342,7 @@ def walk_multipart_email(self, email_index):
"""
if not self._is_walking_multipart(email_index):
data = self._imap.uid('fetch', email_index, '(RFC822)')[1][0][1]
msg = message_from_string(data)
msg = message_from_bytes(data)
self._start_multipart_walk(email_index, msg)
try:
self._part = next(self._mp_iter)
Expand Down