Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "pypy-3.9"
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ library.

========================= ========================================
Current version 3.0.1
Supported Python versions 3.8 - 3.13
Supported Python versions 3.8 - 3.14
License New BSD
Project home https://github.com/mjs/imapclient/
PyPI https://pypi.python.org/pypi/IMAPClient
Expand Down
2 changes: 1 addition & 1 deletion doc/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ explains IMAP in detail. Other RFCs also apply to various extensions
to the base protocol. These are referred to in the documentation below
where relevant.

Python versions 3.8 through 3.13 are officially supported.
Python versions 3.8 through 3.14 are officially supported.

Getting Started
---------------
Expand Down
32 changes: 6 additions & 26 deletions imapclient/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"""

import imaplib
import io
import socket
import ssl
from typing import Optional, TYPE_CHECKING
Expand All @@ -35,34 +34,15 @@ class IMAP4_TLS(imaplib.IMAP4):
def __init__(
self,
host: str,
port: int,
ssl_context: Optional[ssl.SSLContext],
port: int = 993,
ssl_context: Optional[ssl.SSLContext] = None,
timeout: Optional[float] = None,
):
self.ssl_context = ssl_context
self._timeout = timeout
imaplib.IMAP4.__init__(self, host, port)
self.file: io.BufferedReader
super().__init__(host, port)

def open(
self, host: str = "", port: int = 993, timeout: Optional[float] = None
) -> None:
self.host = host
self.port = port
sock = socket.create_connection(
(host, port), timeout if timeout is not None else self._timeout
)
self.sock = wrap_socket(sock, self.ssl_context, host)
self.file = self.sock.makefile("rb")
def _create_socket(self, timeout: Optional[float]) -> socket.socket:
sock = socket.create_connection((self.host, self.port), timeout=timeout)

def read(self, size: int) -> bytes:
return self.file.read(size)

def readline(self) -> bytes:
return self.file.readline()

def send(self, data: "Buffer") -> None:
self.sock.sendall(data)

def shutdown(self) -> None:
imaplib.IMAP4.shutdown(self)
return wrap_socket(sock, self.ssl_context, self.host)