myl-discovery 0.6.0__tar.gz → 0.6.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.
Files changed (24) hide show
  1. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/.gitignore +2 -0
  2. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/PKG-INFO +2 -1
  3. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/README.md +1 -0
  4. myl_discovery-0.6.2/flake.lock +61 -0
  5. myl_discovery-0.6.2/flake.nix +104 -0
  6. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myl_discovery.egg-info/PKG-INFO +2 -1
  7. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myl_discovery.egg-info/SOURCES.txt +3 -0
  8. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myldiscovery/discovery.py +7 -4
  9. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myldiscovery/main.py +19 -1
  10. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/pyproject.toml +9 -1
  11. myl_discovery-0.6.2/version.txt +1 -0
  12. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/.github/dependabot.yml +0 -0
  13. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/.github/workflows/lint.yaml +0 -0
  14. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/.github/workflows/pypi.yaml +0 -0
  15. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/.github/workflows/release.yaml +0 -0
  16. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/HACKING.md +0 -0
  17. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/LICENSE +0 -0
  18. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myl_discovery.egg-info/dependency_links.txt +0 -0
  19. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myl_discovery.egg-info/entry_points.txt +0 -0
  20. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myl_discovery.egg-info/requires.txt +0 -0
  21. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myl_discovery.egg-info/top_level.txt +0 -0
  22. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myldiscovery/__init__.py +0 -0
  23. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/myldiscovery/__main__.py +0 -0
  24. {myl_discovery-0.6.0 → myl_discovery-0.6.2}/setup.cfg +0 -0
@@ -3,3 +3,5 @@
3
3
  *.egg-info
4
4
  build/
5
5
  dist/
6
+ _version.py
7
+ result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: myl-discovery
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: email autodiscovery
5
5
  Author-email: Philipp Schmitt <philipp@schmitt.co>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -829,3 +829,4 @@ myl-discovery is licensed under the [GNU General Public License v3.0](LICENSE).
829
829
 
830
830
  - https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
831
831
  - https://datatracker.ietf.org/doc/html/rfc6186
832
+ - https://developers.google.com/gmail/imap/imap-smtp
@@ -134,3 +134,4 @@ myl-discovery is licensed under the [GNU General Public License v3.0](LICENSE).
134
134
 
135
135
  - https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
136
136
  - https://datatracker.ietf.org/doc/html/rfc6186
137
+ - https://developers.google.com/gmail/imap/imap-smtp
@@ -0,0 +1,61 @@
1
+ {
2
+ "nodes": {
3
+ "flake-utils": {
4
+ "inputs": {
5
+ "systems": "systems"
6
+ },
7
+ "locked": {
8
+ "lastModified": 1726560853,
9
+ "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
10
+ "owner": "numtide",
11
+ "repo": "flake-utils",
12
+ "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
13
+ "type": "github"
14
+ },
15
+ "original": {
16
+ "owner": "numtide",
17
+ "repo": "flake-utils",
18
+ "type": "github"
19
+ }
20
+ },
21
+ "nixpkgs": {
22
+ "locked": {
23
+ "lastModified": 1730200266,
24
+ "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=",
25
+ "owner": "NixOS",
26
+ "repo": "nixpkgs",
27
+ "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd",
28
+ "type": "github"
29
+ },
30
+ "original": {
31
+ "owner": "NixOS",
32
+ "ref": "nixos-unstable",
33
+ "repo": "nixpkgs",
34
+ "type": "github"
35
+ }
36
+ },
37
+ "root": {
38
+ "inputs": {
39
+ "flake-utils": "flake-utils",
40
+ "nixpkgs": "nixpkgs"
41
+ }
42
+ },
43
+ "systems": {
44
+ "locked": {
45
+ "lastModified": 1681028828,
46
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
47
+ "owner": "nix-systems",
48
+ "repo": "default",
49
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
50
+ "type": "github"
51
+ },
52
+ "original": {
53
+ "owner": "nix-systems",
54
+ "repo": "default",
55
+ "type": "github"
56
+ }
57
+ }
58
+ },
59
+ "root": "root",
60
+ "version": 7
61
+ }
@@ -0,0 +1,104 @@
1
+ {
2
+ description = "Email autoconfig library";
3
+
4
+ inputs = {
5
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6
+ flake-utils.url = "github:numtide/flake-utils";
7
+ };
8
+
9
+ outputs =
10
+ {
11
+ self,
12
+ nixpkgs,
13
+ flake-utils,
14
+ ...
15
+ }:
16
+ flake-utils.lib.eachDefaultSystem (
17
+ system:
18
+ let
19
+ pkgs = nixpkgs.legacyPackages.${system};
20
+
21
+ mylDiscovery = pkgs.python3Packages.buildPythonApplication {
22
+ pname = "myl-discovery";
23
+ version = builtins.readFile ./version.txt;
24
+ pyproject = true;
25
+
26
+ src = ./.;
27
+
28
+ buildInputs = [
29
+ pkgs.python3Packages.setuptools
30
+ pkgs.python3Packages.setuptools-scm
31
+ ];
32
+
33
+ propagatedBuildInputs = with pkgs.python3Packages; [
34
+ dnspython
35
+ exchangelib
36
+ requests
37
+ rich
38
+ xmltodict
39
+ ];
40
+
41
+ pythonImportsCheck = [ "myldiscovery" ];
42
+
43
+ meta = {
44
+ description = "Email autodiscovery";
45
+ homepage = "https://github.com/pschmitt/myl-discovery";
46
+ license = pkgs.lib.licenses.gpl3Only;
47
+ maintainers = with pkgs.lib.maintainers; [ pschmitt ];
48
+ platforms = pkgs.lib.platforms.all;
49
+ };
50
+ };
51
+
52
+ devShell = pkgs.mkShell {
53
+ name = "myl-discovery-devshell";
54
+
55
+ buildInputs = [
56
+ pkgs.python3
57
+ pkgs.python3Packages.dnspython
58
+ pkgs.python3Packages.exchangelib
59
+ pkgs.python3Packages.requests
60
+ pkgs.python3Packages.rich
61
+ pkgs.python3Packages.setuptools
62
+ pkgs.python3Packages.setuptools-scm
63
+ pkgs.python3Packages.xmltodict
64
+ ];
65
+
66
+ # Additional development tools
67
+ nativeBuildInputs = [
68
+ pkgs.gh # GitHub CLI
69
+ pkgs.git
70
+ pkgs.python3Packages.ipython
71
+ pkgs.neovim
72
+ ];
73
+
74
+ # Environment variables and shell hooks
75
+ shellHook = ''
76
+ export PYTHONPATH=${self.packages.${system}.default}/lib/python3.x/site-packages
77
+ echo -e "\e[34mWelcome to the myl-discovery development shell!\e[0m"
78
+ # Activate a virtual environment if desired
79
+ # source .venv/bin/activate
80
+ '';
81
+
82
+ # Optional: Set up a Python virtual environment
83
+ # if you prefer using virtualenv or similar tools
84
+ # you can uncomment and configure the following lines
85
+ # shellHook = ''
86
+ # if [ ! -d .venv ]; then
87
+ # python3 -m venv .venv
88
+ # source .venv/bin/activate
89
+ # pip install --upgrade pip
90
+ # else
91
+ # source .venv/bin/activate
92
+ # fi
93
+ # '';
94
+ };
95
+ in
96
+ {
97
+ # pkgs
98
+ packages."myl-discovery" = mylDiscovery;
99
+ defaultPackage = mylDiscovery;
100
+
101
+ devShells.default = devShell;
102
+ }
103
+ );
104
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: myl-discovery
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: email autodiscovery
5
5
  Author-email: Philipp Schmitt <philipp@schmitt.co>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -829,3 +829,4 @@ myl-discovery is licensed under the [GNU General Public License v3.0](LICENSE).
829
829
 
830
830
  - https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
831
831
  - https://datatracker.ietf.org/doc/html/rfc6186
832
+ - https://developers.google.com/gmail/imap/imap-smtp
@@ -2,7 +2,10 @@
2
2
  HACKING.md
3
3
  LICENSE
4
4
  README.md
5
+ flake.lock
6
+ flake.nix
5
7
  pyproject.toml
8
+ version.txt
6
9
  .github/dependabot.yml
7
10
  .github/workflows/lint.yaml
8
11
  .github/workflows/pypi.yaml
@@ -280,14 +280,14 @@ def autodiscover_port_scan(server):
280
280
  }
281
281
 
282
282
 
283
- def autodiscover_autoconfig(domain):
283
+ def autodiscover_autoconfig(domain, insecure=False):
284
284
  autoconfig = autodiscover_txt(domain)
285
285
 
286
286
  if not autoconfig:
287
287
  LOGGER.warning("Failed to autodiscover using TXT records")
288
288
  return
289
289
 
290
- res = requests.get(autoconfig)
290
+ res = requests.get(autoconfig, verify=not insecure)
291
291
  res.raise_for_status()
292
292
 
293
293
  try:
@@ -297,12 +297,15 @@ def autodiscover_autoconfig(domain):
297
297
  return parse_autodiscover(res.text)
298
298
 
299
299
 
300
- def autodiscover(email_addr, username=None, password=None):
300
+ def autodiscover(email_addr, username=None, password=None, insecure=False):
301
301
  domain = email_addr.split("@")[-1]
302
+
302
303
  if not domain:
303
304
  raise ValueError(f"Invalid email address {email_addr}")
305
+
304
306
  if domain == "gmail.com":
305
307
  LOGGER.debug("Gmail detected, skipping autodiscover")
308
+ # https://developers.google.com/gmail/imap/imap-smtp
306
309
  return {
307
310
  "imap": {
308
311
  "server": "imap.gmail.com",
@@ -318,7 +321,7 @@ def autodiscover(email_addr, username=None, password=None):
318
321
  },
319
322
  }
320
323
 
321
- res = autodiscover_autoconfig(domain)
324
+ res = autodiscover_autoconfig(domain, insecure=insecure)
322
325
 
323
326
  if not res:
324
327
  res = autodiscover_srv(domain)
@@ -3,6 +3,7 @@
3
3
 
4
4
  import argparse
5
5
  import logging
6
+ from importlib.metadata import PackageNotFoundError, version
6
7
 
7
8
  from rich import print_json
8
9
  from rich.console import Console
@@ -11,11 +12,22 @@ from rich.table import Table
11
12
 
12
13
  from myldiscovery import autodiscover
13
14
 
15
+ try:
16
+ __version__ = version("myl-discovery")
17
+ except PackageNotFoundError:
18
+ pass
19
+
14
20
  LOGGER = logging.getLogger(__name__)
15
21
 
16
22
 
17
23
  def parse_args():
18
24
  parser = argparse.ArgumentParser()
25
+ parser.add_argument(
26
+ "-V",
27
+ "--version",
28
+ action="version",
29
+ version=f"%(prog)s {__version__}",
30
+ )
19
31
  parser.add_argument("-j", "--json", action="store_true", default=False)
20
32
  parser.add_argument("-d", "--debug", action="store_true", default=False)
21
33
  parser.add_argument(
@@ -24,6 +36,9 @@ def parse_args():
24
36
  parser.add_argument(
25
37
  "-p", "--password", required=False, help="Password (Exchange only)"
26
38
  )
39
+ parser.add_argument(
40
+ "--insecure", required=False, action="store_true", default=False
41
+ )
27
42
  parser.add_argument("EMAIL")
28
43
  return parser.parse_args()
29
44
 
@@ -40,7 +55,10 @@ def main():
40
55
 
41
56
  try:
42
57
  res = autodiscover(
43
- args.EMAIL, username=args.username, password=args.password
58
+ args.EMAIL,
59
+ username=args.username,
60
+ password=args.password,
61
+ insecure=args.insecure,
44
62
  )
45
63
  if args.json:
46
64
  print_json(data=res)
@@ -22,7 +22,15 @@ dependencies = [
22
22
  "rich >= 13.0.0, < 14.0.0",
23
23
  "xmltodict >= 0.13.0, < 1.0.0"
24
24
  ]
25
- version = "0.6.0"
25
+ dynamic = ["version"]
26
+
27
+ [tool.setuptools_scm]
28
+ version_file = "version.txt"
29
+ version_scheme = "only-version"
30
+ local_scheme = "no-local-version"
31
+
32
+ [tool.setuptools]
33
+ packages = ["myldiscovery"]
26
34
 
27
35
  [project.urls]
28
36
  homepage = "https://github.com/pschmitt/myl-discovery"
@@ -0,0 +1 @@
1
+ 0.6.2
File without changes
File without changes
File without changes