myl 0.8.8__tar.gz → 0.8.10__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.
- {myl-0.8.8 → myl-0.8.10}/.github/workflows/release.yaml +1 -1
- {myl-0.8.8 → myl-0.8.10}/PKG-INFO +2 -2
- {myl-0.8.8 → myl-0.8.10}/myl.egg-info/PKG-INFO +2 -2
- {myl-0.8.8 → myl-0.8.10}/myl.egg-info/requires.txt +1 -1
- {myl-0.8.8 → myl-0.8.10}/myl.py +104 -19
- {myl-0.8.8 → myl-0.8.10}/pyproject.toml +2 -2
- {myl-0.8.8 → myl-0.8.10}/.github/dependabot.yml +0 -0
- {myl-0.8.8 → myl-0.8.10}/.github/workflows/lint.yaml +0 -0
- {myl-0.8.8 → myl-0.8.10}/.github/workflows/pypi.yaml +0 -0
- {myl-0.8.8 → myl-0.8.10}/.gitignore +0 -0
- {myl-0.8.8 → myl-0.8.10}/LICENSE +0 -0
- {myl-0.8.8 → myl-0.8.10}/README.md +0 -0
- {myl-0.8.8 → myl-0.8.10}/myl.egg-info/SOURCES.txt +0 -0
- {myl-0.8.8 → myl-0.8.10}/myl.egg-info/dependency_links.txt +0 -0
- {myl-0.8.8 → myl-0.8.10}/myl.egg-info/entry_points.txt +0 -0
- {myl-0.8.8 → myl-0.8.10}/myl.egg-info/top_level.txt +0 -0
- {myl-0.8.8 → myl-0.8.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: myl
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.10
|
4
4
|
Summary: Dead simple IMAP CLI client
|
5
5
|
Author-email: Philipp Schmitt <philipp@schmitt.co>
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
@@ -688,7 +688,7 @@ Requires-Python: >=3.8
|
|
688
688
|
Description-Content-Type: text/markdown
|
689
689
|
License-File: LICENSE
|
690
690
|
Requires-Dist: imap-tools<2.0.0,>=1.5.0
|
691
|
-
Requires-Dist: myl-discovery>=0.
|
691
|
+
Requires-Dist: myl-discovery>=0.6.0
|
692
692
|
Requires-Dist: rich<14.0.0,>=13.0.0
|
693
693
|
|
694
694
|
# 📧 myl
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: myl
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.10
|
4
4
|
Summary: Dead simple IMAP CLI client
|
5
5
|
Author-email: Philipp Schmitt <philipp@schmitt.co>
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
@@ -688,7 +688,7 @@ Requires-Python: >=3.8
|
|
688
688
|
Description-Content-Type: text/markdown
|
689
689
|
License-File: LICENSE
|
690
690
|
Requires-Dist: imap-tools<2.0.0,>=1.5.0
|
691
|
-
Requires-Dist: myl-discovery>=0.
|
691
|
+
Requires-Dist: myl-discovery>=0.6.0
|
692
692
|
Requires-Dist: rich<14.0.0,>=13.0.0
|
693
693
|
|
694
694
|
# 📧 myl
|
{myl-0.8.8 → myl-0.8.10}/myl.py
RENAMED
@@ -1,10 +1,12 @@
|
|
1
1
|
import argparse
|
2
|
+
import json
|
2
3
|
import logging
|
4
|
+
import ssl
|
3
5
|
import sys
|
4
6
|
|
5
7
|
import imap_tools
|
6
8
|
from myldiscovery import autodiscover
|
7
|
-
from rich import print
|
9
|
+
from rich import print, print_json
|
8
10
|
from rich.console import Console
|
9
11
|
from rich.logging import RichHandler
|
10
12
|
from rich.table import Table
|
@@ -44,8 +46,15 @@ def parse_args():
|
|
44
46
|
parser.add_argument(
|
45
47
|
"-P", "--port", help="IMAP server port", default=IMAP_PORT
|
46
48
|
)
|
49
|
+
parser.add_argument("--ssl", help="SSL", action="store_true", default=True)
|
47
50
|
parser.add_argument(
|
48
|
-
"--starttls", help="
|
51
|
+
"--starttls", help="STARTTLS", action="store_true", default=False
|
52
|
+
)
|
53
|
+
parser.add_argument(
|
54
|
+
"--insecure",
|
55
|
+
help="Disable cert validation",
|
56
|
+
action="store_true",
|
57
|
+
default=False,
|
49
58
|
)
|
50
59
|
parser.add_argument(
|
51
60
|
"-c",
|
@@ -73,8 +82,14 @@ def parse_args():
|
|
73
82
|
action="store_true",
|
74
83
|
)
|
75
84
|
parser.add_argument("-S", "--search", help="Search string", default="ALL")
|
76
|
-
parser.add_argument("-w", "--wrap", help="Wrap text", action="store_true")
|
77
85
|
parser.add_argument("-H", "--html", help="Show HTML", action="store_true")
|
86
|
+
parser.add_argument(
|
87
|
+
"-j",
|
88
|
+
"--json",
|
89
|
+
help="JSON output",
|
90
|
+
action="store_true",
|
91
|
+
default=False,
|
92
|
+
)
|
78
93
|
parser.add_argument(
|
79
94
|
"-r",
|
80
95
|
"--raw",
|
@@ -124,6 +139,7 @@ def main():
|
|
124
139
|
args.server = settings.get("server")
|
125
140
|
args.port = settings.get("port", IMAP_PORT)
|
126
141
|
args.starttls = settings.get("starttls")
|
142
|
+
args.ssl = settings.get("ssl")
|
127
143
|
|
128
144
|
if args.sent:
|
129
145
|
args.folder = "Sent"
|
@@ -138,24 +154,39 @@ def main():
|
|
138
154
|
)
|
139
155
|
return 2
|
140
156
|
|
157
|
+
json_data = []
|
141
158
|
table = Table(
|
142
|
-
expand=True,
|
143
159
|
show_header=not args.no_title,
|
144
160
|
header_style="bold",
|
161
|
+
expand=True,
|
145
162
|
show_lines=False,
|
163
|
+
show_edge=False,
|
164
|
+
pad_edge=False,
|
146
165
|
box=None,
|
166
|
+
row_styles=["", "dim"],
|
147
167
|
)
|
148
|
-
table.add_column("ID", style="red", no_wrap=
|
149
|
-
table.add_column(
|
150
|
-
|
151
|
-
)
|
152
|
-
|
153
|
-
|
168
|
+
table.add_column("ID", style="red", no_wrap=True)
|
169
|
+
table.add_column("Subject", style="green", no_wrap=True, ratio=3)
|
170
|
+
table.add_column("From", style="blue", no_wrap=True, ratio=2)
|
171
|
+
table.add_column("Date", style="cyan", no_wrap=True)
|
172
|
+
|
173
|
+
ssl_context = ssl.create_default_context()
|
174
|
+
if args.insecure:
|
175
|
+
ssl_context.check_hostname = False
|
176
|
+
ssl_context.verify_mode = ssl.CERT_NONE
|
154
177
|
|
155
|
-
|
178
|
+
mb_kwargs = {"host": args.server, "port": args.port}
|
179
|
+
if args.ssl:
|
180
|
+
mb = imap_tools.MailBox
|
181
|
+
mb_kwargs["ssl_context"] = ssl_context
|
182
|
+
elif args.starttls:
|
183
|
+
mb = imap_tools.MailBoxTls
|
184
|
+
mb_kwargs["ssl_context"] = ssl_context
|
185
|
+
else:
|
186
|
+
mb = imap_tools.MailBoxUnencrypted
|
156
187
|
|
157
188
|
try:
|
158
|
-
with mb(
|
189
|
+
with mb(**mb_kwargs).login(
|
159
190
|
args.username, args.password, args.folder
|
160
191
|
) as mailbox:
|
161
192
|
if args.MAILID:
|
@@ -178,6 +209,31 @@ def main():
|
|
178
209
|
if args.raw:
|
179
210
|
print(msg.obj.as_string())
|
180
211
|
return 0
|
212
|
+
elif args.json:
|
213
|
+
print_json(
|
214
|
+
json.dumps(
|
215
|
+
{
|
216
|
+
"uid": msg.uid,
|
217
|
+
"subject": msg.subject,
|
218
|
+
"from": msg.from_,
|
219
|
+
"to": msg.to,
|
220
|
+
"date": msg.date.strftime(
|
221
|
+
"%Y-%m-%d %H:%M:%S"
|
222
|
+
),
|
223
|
+
"timestamp": str(
|
224
|
+
int(msg.date.timestamp())
|
225
|
+
),
|
226
|
+
"content": {
|
227
|
+
"raw": msg.obj.as_string(),
|
228
|
+
"html": msg.html,
|
229
|
+
"text": msg.text,
|
230
|
+
},
|
231
|
+
"attachments": msg.attachments,
|
232
|
+
}
|
233
|
+
)
|
234
|
+
)
|
235
|
+
return 0
|
236
|
+
|
181
237
|
print(msg.text if not args.html else msg.html)
|
182
238
|
for att in msg.attachments:
|
183
239
|
print(
|
@@ -194,17 +250,46 @@ def main():
|
|
194
250
|
headers_only=False, # required for attachments
|
195
251
|
):
|
196
252
|
subj_prefix = "📎 " if len(msg.attachments) > 0 else ""
|
197
|
-
|
198
|
-
msg.
|
199
|
-
|
200
|
-
|
201
|
-
msg.from_,
|
202
|
-
msg.date.strftime("%H:%M %d/%m/%Y") if msg.date else "???",
|
253
|
+
subject = (
|
254
|
+
msg.subject.replace("\n", "")
|
255
|
+
if msg.subject
|
256
|
+
else "<no-subject>"
|
203
257
|
)
|
258
|
+
if args.json:
|
259
|
+
json_data.append(
|
260
|
+
{
|
261
|
+
"uid": msg.uid,
|
262
|
+
"subject": msg.subject,
|
263
|
+
"from": msg.from_,
|
264
|
+
"to": msg.to,
|
265
|
+
"date": msg.date.strftime("%Y-%m-%d %H:%M:%S"),
|
266
|
+
"timestamp": str(int(msg.date.timestamp())),
|
267
|
+
"content": {
|
268
|
+
"raw": msg.obj.as_string(),
|
269
|
+
"html": msg.html,
|
270
|
+
"text": msg.text,
|
271
|
+
},
|
272
|
+
"attachments": msg.attachments,
|
273
|
+
}
|
274
|
+
)
|
275
|
+
else:
|
276
|
+
table.add_row(
|
277
|
+
msg.uid if msg.uid else "???",
|
278
|
+
f"{subj_prefix}{subject}",
|
279
|
+
msg.from_,
|
280
|
+
(
|
281
|
+
msg.date.strftime("%H:%M %d/%m/%Y")
|
282
|
+
if msg.date
|
283
|
+
else "???"
|
284
|
+
),
|
285
|
+
)
|
204
286
|
if len(table.rows) >= args.count:
|
205
287
|
break
|
206
288
|
|
207
|
-
|
289
|
+
if args.json:
|
290
|
+
print_json(json.dumps(json_data))
|
291
|
+
else:
|
292
|
+
console.print(table)
|
208
293
|
return 0
|
209
294
|
except Exception:
|
210
295
|
console.print_exception(show_locals=True)
|
@@ -17,10 +17,10 @@ classifiers = [
|
|
17
17
|
]
|
18
18
|
dependencies = [
|
19
19
|
"imap-tools >= 1.5.0, < 2.0.0",
|
20
|
-
"myl-discovery >= 0.
|
20
|
+
"myl-discovery >= 0.6.0",
|
21
21
|
"rich >= 13.0.0, <14.0.0",
|
22
22
|
]
|
23
|
-
version = "0.8.
|
23
|
+
version = "0.8.10"
|
24
24
|
|
25
25
|
[project.urls]
|
26
26
|
homepage = "https://github.com/pschmitt/myl"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{myl-0.8.8 → myl-0.8.10}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|