Skip to content

Commit

Permalink
Memory Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ZibraMax committed May 4, 2022
1 parent c2f5626 commit 9eb20df
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 25 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
name: Build status

on:
release:
types: [created]
release:
types: [created]

jobs:
deploy:
deploy:
runs-on: ubuntu-latest

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
python -m pip install --editable .
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ F_BUILD/
AFEM.egg-info/
*.pyc
secrets.txt
sendEmail.py
# sendEmail.py
*.cpython-37.pyc
*.csv
*.log
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import sys
sys.path.insert(0, os.path.abspath('../../src/'))
sys.path.insert(0, os.path.abspath('../../'))
__version__ = importlib.metadata.version('FEM')
__version__ = importlib.metadata.version('AFEM')
# -- Project information -----------------------------------------------------

project = 'FEM'
Expand Down
101 changes: 101 additions & 0 deletions sendEmail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import smtplib
from email.utils import formataddr
from email.message import EmailMessage
from email.mime.application import MIMEApplication
from email.mime.text import MIMEText
from os.path import basename
from email.mime.multipart import MIMEMultipart


def sendMailOutlook(mss="Tu script ha finalizado de correr", secrests_path='secrets.txt', files=None):
"""Envia un correo electrónico a travez de Outlook/Hotmial/Live. Se debe crear un archivos secrets.txt que contenga:
Primera linea: correo electronico del que envia el mensaje. Ejemplo: espaiderman@hotmail.com
Segunda linea: contraseña del correo electrónico
Tercera linea: correo electrónico del destinatario. Ejemplo: fatman@gmail.com
El archivo completo se ve así:
espaiderman@hotmail.com
MeDanMiedoLosGatos
fatman@gmail.com
Args:
mss (str, optional): Cuerpo del correo electrónico. Defaults to "Tu script ha finalizado de correr".
secrests_path (str, optional): Ruta al archivo secrets.txt . Defaults to 'secrets.txt'.
"""

with open(secrests_path) as f:
e, p, r = f.readlines()
e = e.replace("\n", "")
p = p.replace("\n", "")
r = r.replace("\n", "")
y = {"sender_email": e, "password": p, "recipient_email": r}

msg = MIMEMultipart()
msg['From'] = formataddr(('Python', y["sender_email"]))
msg['To'] = y['recipient_email']
msg['Subject'] = "Tu script ha finalizado!"
msg.attach(MIMEText(mss))
# 1/0
for f in files or []:
with open(f, "rb") as fil:
part = MIMEApplication(
fil.read(),
Name=basename(f)
)
# After the file is closed
part['Content-Disposition'] = 'attachment; filename="%s"' % basename(f)
msg.attach(part)
s = smtplib.SMTP("smtp-mail.outlook.com", 587)
# Hostname to send for this command defaults to the fully qualified domain name of the local host.
s.ehlo()
s.starttls() # Puts connection to SMTP server in TLS mode
s.ehlo()
s.login(y["sender_email"], y['password'])
s.sendmail(y["sender_email"], y["recipient_email"], msg.as_string())
s.quit()


def sendMailGmail(mss="Tu script ha finalizado de correr", secrests_path='secrets.txt'):
"""Envia un correo electrónico a travez de Gmail. Se debe crear un archivos secrets.txt que contenga:
Primera linea: correo electronico del que envia el mensaje. Ejemplo: espaiderman@gmail.com
Segunda linea: contraseña del correo electrónico
Tercera linea: correo electrónico del destinatario. Ejemplo: fatman@gmail.com
El archivo completo se ve así:
espaiderman@gmail.com
MeDanMiedoLosGatos
fatman@gmail.com
Args:
mss (str, optional): Cuerpo del correo electrónico. Defaults to "Tu script ha finalizado de correr".
secrests_path (str, optional): Ruta al archivo secrets.txt . Defaults to 'secrets.txt'.
"""
with open(secrests_path) as f:
e, p, r = f.readlines()
e = e.replace("\n", "")
p = p.replace("\n", "")
r = r.replace("\n", "")
y = {"sender_email": e, "password": p, "recipient_email": r}

msg = EmailMessage()
msg['From'] = formataddr(('Python', y["sender_email"]))
msg['To'] = y['recipient_email']
msg['Subject'] = "Tu script ha finalizado!"
msg.set_content(mss)
# 1/0
s = smtplib.SMTP("smtp.gmail.com", 587)
# Hostname to send for this command defaults to the fully qualified domain name of the local host.
s.ehlo()
s.starttls() # Puts connection to SMTP server in TLS mode
s.ehlo()
s.login(y["sender_email"], y['password'])
s.sendmail(y["sender_email"], y["recipient_email"], msg.as_string())
s.quit()


if __name__ == '__main__':
sendMailOutlook()
2 changes: 1 addition & 1 deletion src/FEM/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
__author__ = "Arturo Rodriguez - da.rodriguezh@uniandes.edu.co"
__version__ = "1.0.30"
__version__ = "1.0.31"
from .Elements import *
from .Geometry import *
from .Core import *
Expand Down

0 comments on commit 9eb20df

Please sign in to comment.