py416
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: py416 | ||
| Version: 0.54 | ||
| Version: 0.55 | ||
| Summary: don't question my methods | ||
@@ -5,0 +5,0 @@ Author-email: Ezio416 <ezezio416@gmail.com> |
+1
-1
@@ -7,3 +7,3 @@ [build-system] | ||
| name = "py416" | ||
| version = "0.54" | ||
| version = "0.55" | ||
| authors = [ | ||
@@ -10,0 +10,0 @@ { name="Ezio416", email="ezezio416@gmail.com" }, |
| Metadata-Version: 2.1 | ||
| Name: py416 | ||
| Version: 0.54 | ||
| Version: 0.55 | ||
| Summary: don't question my methods | ||
@@ -5,0 +5,0 @@ Author-email: Ezio416 <ezezio416@gmail.com> |
@@ -5,4 +5,4 @@ ''' | ||
| Created: 2022-08-15 | ||
| Updated: 2022-11-10 | ||
| Version: 0.54 | ||
| Updated: 2022-11-11 | ||
| Version: 0.55 | ||
@@ -12,3 +12,3 @@ A collection of various functions | ||
| from .general import * | ||
| __version__ = 0, 54 | ||
| __version__ = 0, 55 | ||
| v = __version__ |
+59
-2
| ''' | ||
| | Author: Ezio416 | ||
| | Created: 2022-08-18 | ||
| | Updated: 2022-11-10 | ||
| | Updated: 2022-11-11 | ||
| - Functions for various things | ||
| - These are all imported to py416 directly, so just call them like: :func:`py416.timestamp` | ||
| - These are all imported to py416 directly, so just call them like so: :func:`py416.timestamp` | ||
| ''' | ||
| from datetime import datetime as dt | ||
| from email.message import EmailMessage | ||
| from re import findall | ||
| from smtplib import SMTP_SSL | ||
| from ssl import create_default_context | ||
@@ -54,2 +57,56 @@ from .variables import SEC_D, SEC_H, SEC_M | ||
| def emailsmtp(sender_email: str, recipient: str, subject: str, body: str, smtp_server: str, smtp_port: int, password: str, sender_name: str = '') -> bool: | ||
| ''' | ||
| - sends an email via SMTP | ||
| Parameters | ||
| ---------- | ||
| sender_email: str | ||
| - email address to send from | ||
| recipient: str | ||
| - email address to send to | ||
| subject: str | ||
| - text to put in the email subject | ||
| body: str | ||
| - test to put in the email body | ||
| smtp_server: str | ||
| - host name for SMTP server | ||
| smtp_port: int | ||
| - port for SMTP server | ||
| password: str | ||
| - password for sender email | ||
| sender_name: str | ||
| - name to show in the 'from' field | ||
| - default: none | ||
| Returns | ||
| ------- | ||
| bool | ||
| - whether send was successful | ||
| ''' | ||
| msg = EmailMessage() | ||
| if sender_name: | ||
| msg['From'] = f'{sender_name} <{sender_email}>' | ||
| else: | ||
| msg['From'] = sender_email | ||
| msg['To'] = recipient | ||
| msg['Subject'] = subject | ||
| msg.set_content(body) | ||
| try: | ||
| with SMTP_SSL(host=smtp_server, port=smtp_port, context=create_default_context()) as server: | ||
| server.login(sender_email, password) | ||
| server.send_message(msg) | ||
| return True | ||
| except Exception: | ||
| return False | ||
| def gettype(thing) -> str: | ||
@@ -56,0 +113,0 @@ ''' |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
148783
0.98%1498
3.1%