Skip to content

Commit

Permalink
ADD: variable argument support on transport functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Cesar Caballero Díaz committed Oct 18, 2018
1 parent 59d5499 commit e64d0b2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions mailproc/transports/file_receiver_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ class FileReceiverTransport(BaseReceiverTransport):
:param directory: Directory path for obtaining raw emails in file system.
"""

def __init__(self, directory):
def __init__(self, directory, **kwargs):
self.directory = directory

def connect(self):
def connect(self, **kwargs):
pass

def close(self):
pass

def get_mails(self, extension='.eml', delete=False):
def get_mails(self, extension='.eml', delete=False, **kwargs):
"""
Returns mails stored in `directory` constructor parameter
Expand Down
6 changes: 3 additions & 3 deletions mailproc/transports/file_sender_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ class FileSenderTransport(BaseSenderTransport):
:param directory: Directory path for saving raw emails in file system.
"""

def __init__(self, directory):
def __init__(self, directory, **kwargs):
self.directory = directory

def connect(self):
def connect(self, **kwargs):
pass

def close(self):
pass

def send_mail(self, email_from, email_to, email_subject, email_text, email_html=None, email_bcc=None,
email_encode='utf-8', log=None, json_attachment=None, json_attachment_filename='attachment.json',
json_attachment_base64_encode=False, json_attachment_gzip=False):
json_attachment_base64_encode=False, json_attachment_gzip=False, **kwargs):
"""
Save an email message with text only or multipart HTML body in `directory`
constructor parameter path
Expand Down
4 changes: 2 additions & 2 deletions mailproc/transports/imap_idle_receiver_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ImapIdleReceiverTransport(ImapReceiverTransport):
"""

def __init__(self, server, username, password, callback,
port=None, use_ssl=True, idle_timeout=60*8, idle_loop=True):
port=None, use_ssl=True, idle_timeout=60*8, idle_loop=True, **kwargs):
super(ImapIdleReceiverTransport, self).__init__(server, username, password, port, use_ssl)

self.callback = callback
Expand All @@ -44,7 +44,7 @@ def __init__(self, server, username, password, callback,
self.idle_tag = None
self.idle_loop = idle_loop

def get_mails(self, get_msgs_type='(UNSEEN)', mailbox="INBOX", delete=False):
def get_mails(self, get_msgs_type='(UNSEEN)', mailbox="INBOX", delete=False, **kwargs):
"""
Starts monitoring an IMAP inbox for incoming emails
Expand Down
6 changes: 3 additions & 3 deletions mailproc/transports/imap_receiver_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ class ImapReceiverTransport(BaseReceiverTransport):
:param use_ssl: Use ssl connection. Default: True
"""

def __init__(self, server, username, password, port=None, use_ssl=True):
def __init__(self, server, username, password, port=None, use_ssl=True, **kwargs):
self.server = server
self.username = username
self.password = password
self.port = port
self.use_ssl = use_ssl
self.connection = None

def connect(self):
def connect(self, **kwargs):
"""
Starts a new IMAP connection
"""
Expand Down Expand Up @@ -64,7 +64,7 @@ def close(self):
self.connection.logout()
logging.info('IMAP connection to {0} for {1} closed'.format(self.server, self.username))

def get_mails(self, get_msgs_type='(UNSEEN)', mailbox="INBOX", delete=False):
def get_mails(self, get_msgs_type='(UNSEEN)', mailbox="INBOX", delete=False, **kwargs):
"""
Returns new (unseen) mails from account
Expand Down
4 changes: 2 additions & 2 deletions mailproc/transports/smtp_sender_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SmtpSenderTransport(BaseSenderTransport):
:param use_tls: Use tls secure connection. Default: False
"""

def __init__(self, server, username, password, port=None, use_ssl=True, use_tls=False):
def __init__(self, server, username, password, port=None, use_ssl=True, use_tls=False, **kwargs):
self.server = server
self.username = username
self.password = password
Expand Down Expand Up @@ -64,7 +64,7 @@ def close(self):

def send_mail(self, email_from, email_to, email_subject, email_text, email_html=None, email_bcc=None,
email_encode='utf-8', log=None, json_attachment=None, json_attachment_filename='attachment.json',
json_attachment_base64_encode=False, json_attachment_gzip=False):
json_attachment_base64_encode=False, json_attachment_gzip=False, **kwargs):
"""
Send an email message with text only or multipart HTML body
Expand Down

0 comments on commit e64d0b2

Please sign in to comment.