mailsuite 2.2.0__tar.gz → 2.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mailsuite-2.2.0 → mailsuite-2.2.2}/PKG-INFO +2 -2
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/__init__.py +1 -1
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/imap.py +13 -2
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/mailbox/imap.py +1 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/pyproject.toml +1 -1
- {mailsuite-2.2.0 → mailsuite-2.2.2}/.gitignore +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/LICENSE +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/README.md +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/arc.py +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/dkim.py +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/mailbox/__init__.py +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/mailbox/base.py +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/mailbox/gmail.py +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/mailbox/graph.py +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/mailbox/maildir.py +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/smtp.py +0 -0
- {mailsuite-2.2.0 → mailsuite-2.2.2}/mailsuite/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mailsuite
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: A Python package for retrieving, parsing, and sending emails
|
|
5
5
|
Project-URL: Homepage, https://github.com/seanthegeek/mailsuite/
|
|
6
6
|
Project-URL: Documentation, https://seanthegeek.github.io/mailsuite/
|
|
@@ -24,7 +24,7 @@ Requires-Dist: dnspython>=2.0.0
|
|
|
24
24
|
Requires-Dist: expiringdict==1.2.2
|
|
25
25
|
Requires-Dist: html2text>=2020.1.16
|
|
26
26
|
Requires-Dist: imapclient>=3.1.0
|
|
27
|
-
Requires-Dist: mail-parser>=4.1
|
|
27
|
+
Requires-Dist: mail-parser>=4.2.1
|
|
28
28
|
Requires-Dist: publicsuffix2>=2.20190812
|
|
29
29
|
Provides-Extra: all
|
|
30
30
|
Requires-Dist: azure-identity>=1.15.0; extra == 'all'
|
|
@@ -96,13 +96,17 @@ class IMAPClient(imapclient.IMAPClient):
|
|
|
96
96
|
return result.decode("utf-8", "replace")
|
|
97
97
|
return str(result)
|
|
98
98
|
|
|
99
|
-
def _start_idle(self, idle_callback, idle_timeout: int = 30):
|
|
99
|
+
def _start_idle(self, idle_callback, idle_timeout: int = 30, config_reloading=None):
|
|
100
100
|
"""
|
|
101
101
|
Starts an IMAP IDLE session
|
|
102
102
|
|
|
103
103
|
Args:
|
|
104
104
|
idle_callback: A callback function
|
|
105
105
|
idle_timeout: Number of seconds to wait for an IDLE response
|
|
106
|
+
config_reloading: Optional zero-arg callable; when it returns a
|
|
107
|
+
truthy value the IDLE loop exits cleanly so the caller can
|
|
108
|
+
reload config or shut down. Checked at the top of each cycle,
|
|
109
|
+
while IDLE is active, so idle_done() stays valid.
|
|
106
110
|
"""
|
|
107
111
|
if self._idle_supported is False:
|
|
108
112
|
raise imapclient.exceptions.IMAPClientError(
|
|
@@ -115,6 +119,8 @@ class IMAPClient(imapclient.IMAPClient):
|
|
|
115
119
|
# re-arms this loop in place instead of starting a nested IDLE loop.
|
|
116
120
|
self._idle_running = True
|
|
117
121
|
while True:
|
|
122
|
+
if config_reloading and config_reloading():
|
|
123
|
+
break
|
|
118
124
|
try:
|
|
119
125
|
# Refresh the IDLE session every 5 minutes to stay connected
|
|
120
126
|
if time.monotonic() - idle_start_time > 5 * 60:
|
|
@@ -183,6 +189,7 @@ class IMAPClient(imapclient.IMAPClient):
|
|
|
183
189
|
oauth2_token_provider: Optional[Callable[[], str]] = None,
|
|
184
190
|
oauth2_mechanism: str = "XOAUTH2",
|
|
185
191
|
oauth2_vendor: Optional[str] = None,
|
|
192
|
+
config_reloading: Optional[Callable[[], bool]] = None,
|
|
186
193
|
):
|
|
187
194
|
"""
|
|
188
195
|
Connects to an IMAP server
|
|
@@ -339,7 +346,11 @@ class IMAPClient(imapclient.IMAPClient):
|
|
|
339
346
|
# reset_connection() re-runs __init__ from inside the loop, and a
|
|
340
347
|
# nested _start_idle would stack IDLE loops on every reconnect.
|
|
341
348
|
if idle_callback is not None and not getattr(self, "_idle_running", False):
|
|
342
|
-
self._start_idle(
|
|
349
|
+
self._start_idle(
|
|
350
|
+
idle_callback,
|
|
351
|
+
idle_timeout=idle_timeout,
|
|
352
|
+
config_reloading=config_reloading,
|
|
353
|
+
)
|
|
343
354
|
|
|
344
355
|
def reset_connection(self):
|
|
345
356
|
"""Resets the connection to the IMAP server"""
|
|
@@ -174,6 +174,7 @@ class IMAPConnection(MailboxConnection):
|
|
|
174
174
|
oauth2_token_provider=self._oauth2_token_provider,
|
|
175
175
|
oauth2_mechanism=self._oauth2_mechanism,
|
|
176
176
|
oauth2_vendor=self._oauth2_vendor,
|
|
177
|
+
config_reloading=config_reloading,
|
|
177
178
|
)
|
|
178
179
|
except (timeout, IMAPClientError):
|
|
179
180
|
logger.warning("IMAP connection timeout. Reconnecting...")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|