python-plugins 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- python_plugins/__about__.py +1 -1
- python_plugins/email/__init__.py +0 -0
- python_plugins/email/smtp.py +34 -0
- python_plugins/models/__init__.py +0 -0
- python_plugins/models/mixins/__init__.py +4 -0
- python_plugins/models/mixins/data_mixin.py +15 -0
- python_plugins/models/mixins/primary_key_mixin.py +6 -0
- python_plugins/models/mixins/timestamp_mixin.py +20 -0
- python_plugins/models/mixins/user_minxin.py +26 -0
- {python_plugins-0.1.0.dist-info → python_plugins-0.1.2.dist-info}/METADATA +9 -1
- python_plugins-0.1.2.dist-info/RECORD +14 -0
- python_plugins-0.1.0.dist-info/RECORD +0 -6
- {python_plugins-0.1.0.dist-info → python_plugins-0.1.2.dist-info}/WHEEL +0 -0
- {python_plugins-0.1.0.dist-info → python_plugins-0.1.2.dist-info}/licenses/LICENSE.rst +0 -0
python_plugins/__about__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.2"
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from sqlalchemy.orm import mapped_column
|
|
2
|
+
from sqlalchemy.types import JSON
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DataMixin:
|
|
6
|
+
data = mapped_column(type_=JSON)
|
|
7
|
+
|
|
8
|
+
def update_data(self, data: dict):
|
|
9
|
+
if self.data is None:
|
|
10
|
+
new_data = {}
|
|
11
|
+
else:
|
|
12
|
+
new_data = dict(self.data)
|
|
13
|
+
for k in data:
|
|
14
|
+
new_data[k] = data[k]
|
|
15
|
+
self.data = new_data
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from sqlalchemy.orm import Mapped
|
|
3
|
+
from sqlalchemy.orm import mapped_column
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TimestampMixin:
|
|
7
|
+
created_at: Mapped[datetime] = mapped_column(default=datetime.now)
|
|
8
|
+
updated_at: Mapped[datetime] = mapped_column(
|
|
9
|
+
default=datetime.now, onupdate=datetime.now
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CreateTimestampMixin:
|
|
14
|
+
created_at: Mapped[datetime] = mapped_column(default=datetime.now)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class UpdateTimestampMixin:
|
|
18
|
+
updated_at: Mapped[datetime] = mapped_column(
|
|
19
|
+
default=datetime.now, onupdate=datetime.now
|
|
20
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class UserMixin:
|
|
2
|
+
@property
|
|
3
|
+
def is_active(self):
|
|
4
|
+
return self.isactive
|
|
5
|
+
|
|
6
|
+
@property
|
|
7
|
+
def is_authenticated(self):
|
|
8
|
+
return True
|
|
9
|
+
|
|
10
|
+
@property
|
|
11
|
+
def is_anonymous(self):
|
|
12
|
+
return False
|
|
13
|
+
|
|
14
|
+
def get_id(self):
|
|
15
|
+
return self.id
|
|
16
|
+
|
|
17
|
+
def __eq__(self, other):
|
|
18
|
+
if isinstance(other, self.__class__):
|
|
19
|
+
return self.get_id() == other.get_id()
|
|
20
|
+
return NotImplemented
|
|
21
|
+
|
|
22
|
+
def __ne__(self, other):
|
|
23
|
+
equal = self.__eq__(other)
|
|
24
|
+
if equal is NotImplemented:
|
|
25
|
+
return NotImplemented
|
|
26
|
+
return not equal
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: python-plugins
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
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,14 @@ 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'
|
|
47
|
+
Provides-Extra: sqlalchemy
|
|
48
|
+
Requires-Dist: sqlalchemy; extra == 'sqlalchemy'
|
|
41
49
|
Description-Content-Type: text/x-rst
|
|
42
50
|
|
|
43
51
|
python-plugins
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
python_plugins/__about__.py,sha256=YvuYzWnKtqBb-IqG8HAu-nhIYAsgj9Vmc_b9o7vO-js,22
|
|
2
|
+
python_plugins/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
3
|
+
python_plugins/email/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
python_plugins/email/smtp.py,sha256=weSfLVPzROFqwlxDaVhjem522NVEp31lc6PFkbZE1ok,854
|
|
5
|
+
python_plugins/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
python_plugins/models/mixins/__init__.py,sha256=s1S9jtS8W3xbvbshFkh4WvJBqbjScSvN27Chn8_D_Pw,204
|
|
7
|
+
python_plugins/models/mixins/data_mixin.py,sha256=HCc1uvF6_O4yjK38uWAsqysEedLWgc7wtds3NjQTMZ8,366
|
|
8
|
+
python_plugins/models/mixins/primary_key_mixin.py,sha256=QUO-7ZmYtAMMi7ReRQDYV0uwQCnU9dvl6g6GHitYtlA,154
|
|
9
|
+
python_plugins/models/mixins/timestamp_mixin.py,sha256=u9rIu0IrzdCRRbnMk4IN4nTlNNiVPB8yPnTcHjQC1KU,547
|
|
10
|
+
python_plugins/models/mixins/user_minxin.py,sha256=D-N45bunicBuuwKs--s_tyDxxLC3mkxV9Tva8JAhsko,579
|
|
11
|
+
python_plugins-0.1.2.dist-info/METADATA,sha256=uDCEUZwFeovFz8pcWx08SpG-WTn6TNwiw1SeDVl_a3Y,2754
|
|
12
|
+
python_plugins-0.1.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
13
|
+
python_plugins-0.1.2.dist-info/licenses/LICENSE.rst,sha256=d9ee1DxacJqITSYaORZy85rWGNZyZbDNv_r-lY2RQ9s,1099
|
|
14
|
+
python_plugins-0.1.2.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
python_plugins/__about__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
2
|
-
python_plugins/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
3
|
-
python_plugins-0.1.0.dist-info/METADATA,sha256=rNGLHSwmCEQrIzij23X7KN5IyuTyPM4VGifrD6Uah7c,2468
|
|
4
|
-
python_plugins-0.1.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
5
|
-
python_plugins-0.1.0.dist-info/licenses/LICENSE.rst,sha256=d9ee1DxacJqITSYaORZy85rWGNZyZbDNv_r-lY2RQ9s,1099
|
|
6
|
-
python_plugins-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|