python-plugins 0.1.0__tar.gz → 0.1.1__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 (30) hide show
  1. python_plugins-0.1.1/CHANGES.rst +13 -0
  2. {python_plugins-0.1.0 → python_plugins-0.1.1}/PKG-INFO +7 -1
  3. python_plugins-0.1.1/docs/usage.rst +37 -0
  4. {python_plugins-0.1.0 → python_plugins-0.1.1}/pyproject.toml +5 -0
  5. python_plugins-0.1.1/requirements/test.in +2 -0
  6. python_plugins-0.1.1/src/python_plugins/__about__.py +1 -0
  7. python_plugins-0.1.1/src/python_plugins/email/__init__.py +0 -0
  8. python_plugins-0.1.1/src/python_plugins/email/smtp.py +34 -0
  9. python_plugins-0.1.1/tests/conftest.py +9 -0
  10. python_plugins-0.1.1/tests/test_email.py +25 -0
  11. python_plugins-0.1.0/CHANGES.rst +0 -6
  12. python_plugins-0.1.0/docs/usage.rst +0 -14
  13. python_plugins-0.1.0/src/python_plugins/__about__.py +0 -1
  14. {python_plugins-0.1.0 → python_plugins-0.1.1}/.github/workflows/release.yml +0 -0
  15. {python_plugins-0.1.0 → python_plugins-0.1.1}/.gitignore +0 -0
  16. {python_plugins-0.1.0 → python_plugins-0.1.1}/.readthedocs.yaml +0 -0
  17. {python_plugins-0.1.0 → python_plugins-0.1.1}/LICENSE.rst +0 -0
  18. {python_plugins-0.1.0 → python_plugins-0.1.1}/README.rst +0 -0
  19. {python_plugins-0.1.0 → python_plugins-0.1.1}/docs/Makefile +0 -0
  20. {python_plugins-0.1.0 → python_plugins-0.1.1}/docs/api.rst +0 -0
  21. {python_plugins-0.1.0 → python_plugins-0.1.1}/docs/changes.rst +0 -0
  22. {python_plugins-0.1.0 → python_plugins-0.1.1}/docs/conf.py +0 -0
  23. {python_plugins-0.1.0 → python_plugins-0.1.1}/docs/examples.rst +0 -0
  24. {python_plugins-0.1.0 → python_plugins-0.1.1}/docs/index.rst +0 -0
  25. {python_plugins-0.1.0 → python_plugins-0.1.1}/docs/make.bat +0 -0
  26. {python_plugins-0.1.0 → python_plugins-0.1.1}/docs/requirements.txt +0 -0
  27. {python_plugins-0.1.0 → python_plugins-0.1.1}/examples/README.rst +0 -0
  28. {python_plugins-0.1.0 → python_plugins-0.1.1}/requirements/build.in +0 -0
  29. {python_plugins-0.1.0 → python_plugins-0.1.1}/src/python_plugins/__init__.py +0 -0
  30. {python_plugins-0.1.0 → python_plugins-0.1.1}/tests/__init__.py +0 -0
@@ -0,0 +1,13 @@
1
+ v0.1.1
2
+ ------
3
+
4
+ Released 2024-09-16
5
+
6
+ - support send email
7
+
8
+ v0.1.0
9
+ ------
10
+
11
+ Released 2024-08-27
12
+
13
+ - Init release
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-plugins
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A collection of Python functions and classes.
5
5
  Project-URL: Documentation, https://python-plugins.readthedocs.io
6
6
  Project-URL: Source, https://github.com/ojso/python-plugins
@@ -38,6 +38,12 @@ Classifier: Programming Language :: Python :: 3.10
38
38
  Classifier: Programming Language :: Python :: 3.11
39
39
  Classifier: Topic :: Software Development :: Build Tools
40
40
  Requires-Python: >=3.10
41
+ Provides-Extra: cryptography
42
+ Requires-Dist: cryptography; extra == 'cryptography'
43
+ Provides-Extra: pillow
44
+ Requires-Dist: pillow; extra == 'pillow'
45
+ Provides-Extra: qrcode
46
+ Requires-Dist: qrcode; extra == 'qrcode'
41
47
  Description-Content-Type: text/x-rst
42
48
 
43
49
  python-plugins
@@ -0,0 +1,37 @@
1
+ =====
2
+ Usage
3
+ =====
4
+
5
+ .. _installation:
6
+
7
+ Installation
8
+ ==============
9
+
10
+ Install and update using pip:
11
+
12
+ .. code-block:: console
13
+
14
+ (.venv) $ pip install -U python-plugins
15
+
16
+ email
17
+ ======
18
+
19
+ .. code-block:: python
20
+
21
+ # smtp's host
22
+ host = "smtp.host"
23
+ port = "465"
24
+ # smtp's username and password
25
+ user = "test@test.com"
26
+ password = "your password"
27
+
28
+ # receiver and subject and content
29
+ to = "test2@test.com"
30
+ data = {
31
+ "to": to,
32
+ "subject": "subject of msg",
33
+ "content": "content of msg",
34
+ }
35
+
36
+ s = SmtpSSL(host, port, user, password)
37
+ r = s.send_emsg(data)
@@ -26,6 +26,11 @@ requires-python = ">=3.10"
26
26
  dependencies = [
27
27
  ]
28
28
 
29
+ [project.optional-dependencies]
30
+ cryptography = ["cryptography"]
31
+ pillow = ["pillow"]
32
+ qrcode = ["qrcode"]
33
+
29
34
  [project.urls]
30
35
  Documentation = "https://python-plugins.readthedocs.io"
31
36
  Source = "https://github.com/ojso/python-plugins"
@@ -0,0 +1,2 @@
1
+ pytest
2
+ Faker
@@ -0,0 +1 @@
1
+ __version__ = "0.1.1"
@@ -0,0 +1,34 @@
1
+ import smtplib
2
+ from email.message import EmailMessage
3
+
4
+
5
+ class SmtpSSL:
6
+ def __init__(self, host, port, user, password):
7
+ self.host = host
8
+ self.port = port
9
+ self.user = user
10
+ self.password = password
11
+
12
+ def send_emsg(self, data):
13
+ emsg = EmailMessage()
14
+ emsg["Subject"] = data["subject"]
15
+ emsg.set_content(data["content"])
16
+
17
+ if data.get("From") is None:
18
+ emsg["From"] = self.user
19
+
20
+ emsg["To"] = data["to"]
21
+
22
+ if "cc" in data:
23
+ emsg["Cc"] = data["cc"]
24
+
25
+ if "bcc" in data:
26
+ emsg["Bcc"] = data["bcc"]
27
+
28
+ # print(emsg)
29
+
30
+ with smtplib.SMTP_SSL(self.host, self.port) as smtp:
31
+ # smtp.set_debuglevel(1)
32
+ smtp.login(self.user, self.password)
33
+ senderrs = smtp.send_message(emsg)
34
+ return senderrs
@@ -0,0 +1,9 @@
1
+ import pytest
2
+
3
+ from faker import Faker
4
+
5
+ fakers = Faker()
6
+
7
+ @pytest.fixture
8
+ def fake():
9
+ return fakers
@@ -0,0 +1,25 @@
1
+ import pytest
2
+ from python_plugins.email.smtp import SmtpSSL
3
+
4
+
5
+ @pytest.mark.skip(reason="password is empty")
6
+ def test_email(fake):
7
+ host = "smtp.qiye.aliyun.com"
8
+ port = "465"
9
+ user = "test@ojso.com"
10
+ # set password
11
+ password = ""
12
+
13
+ # set to's email
14
+ to = "test@ojso.com"
15
+ content = fake.paragraph()
16
+ data = {
17
+ "to": to,
18
+ "subject": "test." + fake.sentence(),
19
+ "content": content,
20
+ }
21
+
22
+ s = SmtpSSL(host, port, user, password)
23
+ r = s.send_emsg(data)
24
+
25
+ assert not r
@@ -1,6 +0,0 @@
1
- v0.1.0
2
- ------
3
-
4
- Released 2024-08-27
5
-
6
- - Init release
@@ -1,14 +0,0 @@
1
- =====
2
- Usage
3
- =====
4
-
5
- .. _installation:
6
-
7
- Installation
8
- ==============
9
-
10
- Install and update using pip:
11
-
12
- .. code-block:: console
13
-
14
- (.venv) $ pip install -U python-plugins
@@ -1 +0,0 @@
1
- __version__ = "0.1.0"