ikvk / imap_tools

Work with email by IMAP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Mailbox._get_mailbox_client` fails on Python 3.12

link2xt opened this issue · comments

Here is an error from CI:

self = <imap_tools.mailbox.MailBox object at 0x106d83800>

    def _get_mailbox_client(self) -> imaplib.IMAP4:
        if PYTHON_VERSION_MINOR < 9:
            return imaplib.IMAP4_SSL(self._host, self._port, self._keyfile, self._certfile, self._ssl_context)
        else:
>           return imaplib.IMAP4_SSL(self._host, self._port, self._keyfile, self._certfile, self._ssl_context,
                                     self._timeout)
E           TypeError: IMAP4_SSL.__init__() takes from 1 to 3 positional arguments but 7 were given

Since Python 3.12 only host and port are positional arguments. ssl_context and timeout must be keyword arguments, while keyfile and certfile are deprecated: https://docs.python.org/3.12/library/imaplib.html#imaplib.IMAP4_SSL

Thanks, will fix soon