From d67f93626488bb00d51301befe60be797e5c1e11 Mon Sep 17 00:00:00 2001 From: gregori0o Date: Thu, 16 Jun 2022 15:34:19 +0200 Subject: [PATCH 1/3] feat: Setup notification. MailJet api. --- bode/bode/app.py | 4 ++ bode/bode/config.py | 3 + bode/bode/mail_service/sending.py | 59 ++++++++++++++++ bode/bode/models/tag/model.py | 2 +- bode/bode/models/task/model.py | 2 +- bode/poetry.lock | 108 +++++++++++++++++++++++++++++- bode/pyproject.toml | 2 + docker-compose.yaml | 1 + 8 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 bode/bode/mail_service/sending.py diff --git a/bode/bode/app.py b/bode/bode/app.py index e123fd3..89eac3e 100644 --- a/bode/bode/app.py +++ b/bode/bode/app.py @@ -5,6 +5,8 @@ from flask_migrate import upgrade from flask_smorest import Blueprint +from bode.mail_service.sending import start_notify + from .config import Config from .extensions import api, db, migrate from .resources import tags, task_relations, tasks @@ -28,6 +30,8 @@ def create_app(): if CONFIG.AUTO_MIGRATE: upgrade() + start_notify(app) + return app diff --git a/bode/bode/config.py b/bode/bode/config.py index 30afd98..507e47c 100644 --- a/bode/bode/config.py +++ b/bode/bode/config.py @@ -17,3 +17,6 @@ def get_db_uri(): class Config: DATABASE_URI = get_db_uri() AUTO_MIGRATE = os.getenv("AUTO_MIGRATE", False) + + +mailjet_key = (os.getenv("MAILJET_API_KEY"), os.getenv("MAILJET_API_SECRET")) diff --git a/bode/bode/mail_service/sending.py b/bode/bode/mail_service/sending.py new file mode 100644 index 0000000..4d8add0 --- /dev/null +++ b/bode/bode/mail_service/sending.py @@ -0,0 +1,59 @@ +import time + +from datetime import datetime, timedelta +from threading import Thread + +import schedule + +from dateutil import tz +from mailjet_rest import Client + +from bode.config import mailjet_key +from bode.extensions import db +from bode.models.enums import TaskStatus +from bode.models.task.model import Task + +mailjet = Client(auth=mailjet_key, version="v3.1") + + +def send_notification(address, title, due_date, link): + data = { + "Messages": [ + { + "From": {"Email": "itgoatsteam@gmail.com", "Name": "IT Goats"}, + "To": [{"Email": address}], + "Subject": "Notification", + "HTMLPart": f"

Thee deadline is approaching for task:

TITLE:

{title}

" + f"DUE DATE:

{due_date}

CLICK

", + } + ] + } + mailjet.send.create(data=data) + + +def start_notify(app): + def check_task_to_notify(): + nowutc = datetime.utcnow().replace(second=0, microsecond=0) + with app.app_context(): + tasks = db.session.query(Task).filter(Task.status == TaskStatus.TODO.value).all() + address = "itgoatsteam@gmail.com" # get email from database + for task in tasks: + notify_time = 60 # in minutes, get this information from task, if none => not notify + if notify_time is None: + continue + dt = nowutc + timedelta(minutes=notify_time) + due_date = datetime.fromisoformat(str(task.due_date)).replace(second=0, microsecond=0) + delta = dt - due_date.replace(tzinfo=None) + if delta.total_seconds() != 0: + continue + link = f"https://it-goats.netlify.app/task/{task.id}" + due_date_string = due_date.astimezone(tz.gettz("Europe/Warsaw")).strftime("%d-%m-%Y %H:%M") + send_notification(address, task.title, due_date_string, link) + + def start_scheduler(): + schedule.every().minute.at(":00").do(check_task_to_notify) + while True: + schedule.run_pending() + time.sleep(1) + + Thread(target=start_scheduler, daemon=True).start() diff --git a/bode/bode/models/tag/model.py b/bode/bode/models/tag/model.py index 0c63be1..a0c370a 100644 --- a/bode/bode/models/tag/model.py +++ b/bode/bode/models/tag/model.py @@ -2,7 +2,7 @@ from sqlalchemy.dialects.postgresql import UUID -from bode.app import db +from bode.extensions import db task_tag = db.Table( "task_tag", db.Column("task_id", db.ForeignKey("tasks.id")), db.Column("tag_id", db.ForeignKey("tags.id")) diff --git a/bode/bode/models/task/model.py b/bode/bode/models/task/model.py index 283a8dd..4e68367 100644 --- a/bode/bode/models/task/model.py +++ b/bode/bode/models/task/model.py @@ -3,7 +3,7 @@ from sqlalchemy import Enum from sqlalchemy.dialects.postgresql import UUID -from bode.app import db +from bode.extensions import db from bode.models.enums import TaskStatus from bode.models.tag.model import task_tag from bode.models.utc_datetime import UTCDateTime diff --git a/bode/poetry.lock b/bode/poetry.lock index 4f9cfee..81bbd2d 100644 --- a/bode/poetry.lock +++ b/bode/poetry.lock @@ -76,6 +76,25 @@ d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] +[[package]] +name = "certifi" +version = "2022.5.18.1" +description = "Python package for providing Mozilla's CA Bundle." +category = "main" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "charset-normalizer" +version = "2.0.12" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +category = "main" +optional = false +python-versions = ">=3.5.0" + +[package.extras] +unicode_backport = ["unicodedata2"] + [[package]] name = "click" version = "8.1.3" @@ -221,6 +240,14 @@ gevent = ["gevent (>=1.4.0)"] setproctitle = ["setproctitle"] tornado = ["tornado (>=0.2)"] +[[package]] +name = "idna" +version = "3.3" +description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" +optional = false +python-versions = ">=3.5" + [[package]] name = "isort" version = "5.10.1" @@ -257,6 +284,17 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] +[[package]] +name = "mailjet-rest" +version = "1.3.4" +description = "Mailjet V3 API wrapper" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +requests = ">=2.4.3" + [[package]] name = "mako" version = "1.2.0" @@ -440,6 +478,32 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" [package.dependencies] six = ">=1.5" +[[package]] +name = "requests" +version = "2.28.0" +description = "Python HTTP for Humans." +category = "main" +optional = false +python-versions = ">=3.7, <4" + +[package.dependencies] +certifi = ">=2017.4.17" +charset-normalizer = ">=2.0.0,<2.1.0" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<1.27" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] + +[[package]] +name = "schedule" +version = "1.1.0" +description = "Job scheduling for humans." +category = "main" +optional = false +python-versions = ">=3.6" + [[package]] name = "six" version = "1.16.0" @@ -488,6 +552,19 @@ category = "dev" optional = false python-versions = ">=3.7" +[[package]] +name = "urllib3" +version = "1.26.9" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" + +[package.extras] +brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] +secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] + [[package]] name = "wcwidth" version = "0.2.5" @@ -529,7 +606,7 @@ watchdog = ["watchdog"] [metadata] lock-version = "1.1" python-versions = "^3.10" -content-hash = "a189b584941fdd6450f1db4296fd82ea92f066446f8c1266bd580c3aa2125196" +content-hash = "6c79a8ed2680ddf42ad0f0264318f3923d579ee4233ea2c52d96437d1f28e14f" [metadata.files] alembic = [ @@ -573,6 +650,14 @@ black = [ {file = "black-22.3.0-py3-none-any.whl", hash = "sha256:bc58025940a896d7e5356952228b68f793cf5fcb342be703c3a2669a1488cb72"}, {file = "black-22.3.0.tar.gz", hash = "sha256:35020b8886c022ced9282b51b5a875b6d1ab0c387b31a065b84db7c33085ca79"}, ] +certifi = [ + {file = "certifi-2022.5.18.1-py3-none-any.whl", hash = "sha256:f1d53542ee8cbedbe2118b5686372fb33c297fcd6379b050cca0ef13a597382a"}, + {file = "certifi-2022.5.18.1.tar.gz", hash = "sha256:9c5705e395cd70084351dd8ad5c41e65655e08ce46f2ec9cf6c2c08390f71eb7"}, +] +charset-normalizer = [ + {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, + {file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"}, +] click = [ {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, @@ -670,6 +755,10 @@ gunicorn = [ {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"}, {file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"}, ] +idna = [ + {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, + {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, +] isort = [ {file = "isort-5.10.1-py3-none-any.whl", hash = "sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7"}, {file = "isort-5.10.1.tar.gz", hash = "sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"}, @@ -682,6 +771,10 @@ jinja2 = [ {file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, ] +mailjet-rest = [ + {file = "mailjet_rest-1.3.4-py3-none-any.whl", hash = "sha256:635d53ac3fd61020f309c24ee977ae3458654ab39f9c36fc4b50c74e5d8ad410"}, + {file = "mailjet_rest-1.3.4.tar.gz", hash = "sha256:e02663fa0369543bcd48c37a146e8143bb12b9f3512af2d5ba6dfbcc99e64a2d"}, +] mako = [ {file = "Mako-1.2.0-py3-none-any.whl", hash = "sha256:23aab11fdbbb0f1051b93793a58323ff937e98e34aece1c4219675122e57e4ba"}, {file = "Mako-1.2.0.tar.gz", hash = "sha256:9a7c7e922b87db3686210cf49d5d767033a41d4010b284e747682c92bddd8b39"}, @@ -797,6 +890,14 @@ python-dateutil = [ {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, ] +requests = [ + {file = "requests-2.28.0-py3-none-any.whl", hash = "sha256:bc7861137fbce630f17b03d3ad02ad0bf978c844f3536d0edda6499dafce2b6f"}, + {file = "requests-2.28.0.tar.gz", hash = "sha256:d568723a7ebd25875d8d1eaf5dfa068cd2fc8194b2e483d7b1f7c81918dbec6b"}, +] +schedule = [ + {file = "schedule-1.1.0-py2.py3-none-any.whl", hash = "sha256:617adce8b4bf38c360b781297d59918fbebfb2878f1671d189f4f4af5d0567a4"}, + {file = "schedule-1.1.0.tar.gz", hash = "sha256:e6ca13585e62c810e13a08682e0a6a8ad245372e376ba2b8679294f377dfc8e4"}, +] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, @@ -805,6 +906,7 @@ sqlalchemy = [ {file = "SQLAlchemy-1.4.37-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:d9050b0c4a7f5538650c74aaba5c80cd64450e41c206f43ea6d194ae6d060ff9"}, {file = "SQLAlchemy-1.4.37-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:b4c92823889cf9846b972ee6db30c0e3a92c0ddfc76c6060a6cda467aa5fb694"}, {file = "SQLAlchemy-1.4.37-cp27-cp27m-win32.whl", hash = "sha256:b55932fd0e81b43f4aff397c8ad0b3c038f540af37930423ab8f47a20b117e4c"}, + {file = "SQLAlchemy-1.4.37-cp27-cp27m-win_amd64.whl", hash = "sha256:4a17c1a1152ca4c29d992714aa9df3054da3af1598e02134f2e7314a32ef69d8"}, {file = "SQLAlchemy-1.4.37-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:ffe487570f47536b96eff5ef2b84034a8ba4e19aab5ab7647e677d94a119ea55"}, {file = "SQLAlchemy-1.4.37-cp310-cp310-macosx_10_15_x86_64.whl", hash = "sha256:78363f400fbda80f866e8e91d37d36fe6313ff847ded08674e272873c1377ea5"}, {file = "SQLAlchemy-1.4.37-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ee34c85cbda7779d66abac392c306ec78c13f5c73a1f01b8b767916d4895d23"}, @@ -842,6 +944,10 @@ tomli = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] +urllib3 = [ + {file = "urllib3-1.26.9-py2.py3-none-any.whl", hash = "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14"}, + {file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"}, +] wcwidth = [ {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, diff --git a/bode/pyproject.toml b/bode/pyproject.toml index f934612..2d5d90b 100644 --- a/bode/pyproject.toml +++ b/bode/pyproject.toml @@ -23,6 +23,8 @@ psycopg2 = "^2.9.3" flake8-print = "^4.0.0" python-dateutil = "^2.8.2" gunicorn = "^20.1.0" +mailjet-rest = "^1.3.4" +schedule = "^1.1.0" [tool.poetry.dev-dependencies] pytest = "^5.2" diff --git a/docker-compose.yaml b/docker-compose.yaml index a018ce3..2e05dab 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,6 +8,7 @@ services: - "4000:4000" env_file: - .env.example + - .env volumes: - ./bode:/bode/ From 04e70404ca5fd8ae55348b2b9453973f9a6e9850 Mon Sep 17 00:00:00 2001 From: gregori0o Date: Thu, 16 Jun 2022 21:30:16 +0200 Subject: [PATCH 2/3] fix: Change mailjet to sendgrid. --- bode/bode/config.py | 2 +- bode/bode/mail_service/sending.py | 30 ++++---- bode/poetry.lock | 124 +++++++++--------------------- bode/pyproject.toml | 2 +- 4 files changed, 52 insertions(+), 106 deletions(-) diff --git a/bode/bode/config.py b/bode/bode/config.py index 507e47c..60c4515 100644 --- a/bode/bode/config.py +++ b/bode/bode/config.py @@ -19,4 +19,4 @@ class Config: AUTO_MIGRATE = os.getenv("AUTO_MIGRATE", False) -mailjet_key = (os.getenv("MAILJET_API_KEY"), os.getenv("MAILJET_API_SECRET")) +sendgrid_key = os.getenv("SENDGRID_API_KEY") diff --git a/bode/bode/mail_service/sending.py b/bode/bode/mail_service/sending.py index 4d8add0..0e18585 100644 --- a/bode/bode/mail_service/sending.py +++ b/bode/bode/mail_service/sending.py @@ -6,29 +6,29 @@ import schedule from dateutil import tz -from mailjet_rest import Client +from sendgrid import SendGridAPIClient +from sendgrid.helpers.mail import Mail -from bode.config import mailjet_key +from bode.config import sendgrid_key from bode.extensions import db from bode.models.enums import TaskStatus from bode.models.task.model import Task -mailjet = Client(auth=mailjet_key, version="v3.1") +client = SendGridAPIClient(sendgrid_key) def send_notification(address, title, due_date, link): - data = { - "Messages": [ - { - "From": {"Email": "itgoatsteam@gmail.com", "Name": "IT Goats"}, - "To": [{"Email": address}], - "Subject": "Notification", - "HTMLPart": f"

Thee deadline is approaching for task:

TITLE:

{title}

" - f"DUE DATE:

{due_date}

CLICK

", - } - ] - } - mailjet.send.create(data=data) + message = Mail( + from_email="itgoatsteam@gmail.com", + to_emails=address, + subject="Notification", + html_content=f"

The deadline is approaching for task:

TITLE:

{title}

" + f"DUE DATE:

{due_date}

CLICK

", + ) + client.send(message) + + +send_notification def start_notify(app): diff --git a/bode/poetry.lock b/bode/poetry.lock index 81bbd2d..09fd71e 100644 --- a/bode/poetry.lock +++ b/bode/poetry.lock @@ -76,25 +76,6 @@ d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] -[[package]] -name = "certifi" -version = "2022.5.18.1" -description = "Python package for providing Mozilla's CA Bundle." -category = "main" -optional = false -python-versions = ">=3.6" - -[[package]] -name = "charset-normalizer" -version = "2.0.12" -description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -category = "main" -optional = false -python-versions = ">=3.5.0" - -[package.extras] -unicode_backport = ["unicodedata2"] - [[package]] name = "click" version = "8.1.3" @@ -240,14 +221,6 @@ gevent = ["gevent (>=1.4.0)"] setproctitle = ["setproctitle"] tornado = ["tornado (>=0.2)"] -[[package]] -name = "idna" -version = "3.3" -description = "Internationalized Domain Names in Applications (IDNA)" -category = "main" -optional = false -python-versions = ">=3.5" - [[package]] name = "isort" version = "5.10.1" @@ -284,17 +257,6 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] -[[package]] -name = "mailjet-rest" -version = "1.3.4" -description = "Mailjet V3 API wrapper" -category = "main" -optional = false -python-versions = "*" - -[package.dependencies] -requests = ">=2.4.3" - [[package]] name = "mako" version = "1.2.0" @@ -479,22 +441,12 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" six = ">=1.5" [[package]] -name = "requests" -version = "2.28.0" -description = "Python HTTP for Humans." +name = "python-http-client" +version = "3.3.7" +description = "HTTP REST client, simplified for Python" category = "main" optional = false -python-versions = ">=3.7, <4" - -[package.dependencies] -certifi = ">=2017.4.17" -charset-normalizer = ">=2.0.0,<2.1.0" -idna = ">=2.5,<4" -urllib3 = ">=1.21.1,<1.27" - -[package.extras] -socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "schedule" @@ -504,6 +456,18 @@ category = "main" optional = false python-versions = ">=3.6" +[[package]] +name = "sendgrid" +version = "6.9.7" +description = "Twilio SendGrid library for Python" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" + +[package.dependencies] +python-http-client = ">=3.2.1" +starkbank-ecdsa = ">=2.0.1" + [[package]] name = "six" version = "1.16.0" @@ -544,6 +508,14 @@ postgresql_psycopg2cffi = ["psycopg2cffi"] pymysql = ["pymysql (<1)", "pymysql"] sqlcipher = ["sqlcipher3-binary"] +[[package]] +name = "starkbank-ecdsa" +version = "2.0.3" +description = "A lightweight and fast pure python ECDSA library" +category = "main" +optional = false +python-versions = "*" + [[package]] name = "tomli" version = "2.0.1" @@ -552,19 +524,6 @@ category = "dev" optional = false python-versions = ">=3.7" -[[package]] -name = "urllib3" -version = "1.26.9" -description = "HTTP library with thread-safe connection pooling, file post, and more." -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" - -[package.extras] -brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] -socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] - [[package]] name = "wcwidth" version = "0.2.5" @@ -606,7 +565,7 @@ watchdog = ["watchdog"] [metadata] lock-version = "1.1" python-versions = "^3.10" -content-hash = "6c79a8ed2680ddf42ad0f0264318f3923d579ee4233ea2c52d96437d1f28e14f" +content-hash = "51754269aeab7642229de1660266e76ff4ec3b7e0e380b520be04ad796bbd7dc" [metadata.files] alembic = [ @@ -650,14 +609,6 @@ black = [ {file = "black-22.3.0-py3-none-any.whl", hash = "sha256:bc58025940a896d7e5356952228b68f793cf5fcb342be703c3a2669a1488cb72"}, {file = "black-22.3.0.tar.gz", hash = "sha256:35020b8886c022ced9282b51b5a875b6d1ab0c387b31a065b84db7c33085ca79"}, ] -certifi = [ - {file = "certifi-2022.5.18.1-py3-none-any.whl", hash = "sha256:f1d53542ee8cbedbe2118b5686372fb33c297fcd6379b050cca0ef13a597382a"}, - {file = "certifi-2022.5.18.1.tar.gz", hash = "sha256:9c5705e395cd70084351dd8ad5c41e65655e08ce46f2ec9cf6c2c08390f71eb7"}, -] -charset-normalizer = [ - {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, - {file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"}, -] click = [ {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, @@ -755,10 +706,6 @@ gunicorn = [ {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"}, {file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"}, ] -idna = [ - {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, - {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, -] isort = [ {file = "isort-5.10.1-py3-none-any.whl", hash = "sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7"}, {file = "isort-5.10.1.tar.gz", hash = "sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951"}, @@ -771,10 +718,6 @@ jinja2 = [ {file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"}, {file = "Jinja2-3.1.2.tar.gz", hash = "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852"}, ] -mailjet-rest = [ - {file = "mailjet_rest-1.3.4-py3-none-any.whl", hash = "sha256:635d53ac3fd61020f309c24ee977ae3458654ab39f9c36fc4b50c74e5d8ad410"}, - {file = "mailjet_rest-1.3.4.tar.gz", hash = "sha256:e02663fa0369543bcd48c37a146e8143bb12b9f3512af2d5ba6dfbcc99e64a2d"}, -] mako = [ {file = "Mako-1.2.0-py3-none-any.whl", hash = "sha256:23aab11fdbbb0f1051b93793a58323ff937e98e34aece1c4219675122e57e4ba"}, {file = "Mako-1.2.0.tar.gz", hash = "sha256:9a7c7e922b87db3686210cf49d5d767033a41d4010b284e747682c92bddd8b39"}, @@ -890,14 +833,18 @@ python-dateutil = [ {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, ] -requests = [ - {file = "requests-2.28.0-py3-none-any.whl", hash = "sha256:bc7861137fbce630f17b03d3ad02ad0bf978c844f3536d0edda6499dafce2b6f"}, - {file = "requests-2.28.0.tar.gz", hash = "sha256:d568723a7ebd25875d8d1eaf5dfa068cd2fc8194b2e483d7b1f7c81918dbec6b"}, +python-http-client = [ + {file = "python_http_client-3.3.7-py3-none-any.whl", hash = "sha256:ad371d2bbedc6ea15c26179c6222a78bc9308d272435ddf1d5c84f068f249a36"}, + {file = "python_http_client-3.3.7.tar.gz", hash = "sha256:bf841ee45262747e00dec7ee9971dfb8c7d83083f5713596488d67739170cea0"}, ] schedule = [ {file = "schedule-1.1.0-py2.py3-none-any.whl", hash = "sha256:617adce8b4bf38c360b781297d59918fbebfb2878f1671d189f4f4af5d0567a4"}, {file = "schedule-1.1.0.tar.gz", hash = "sha256:e6ca13585e62c810e13a08682e0a6a8ad245372e376ba2b8679294f377dfc8e4"}, ] +sendgrid = [ + {file = "sendgrid-6.9.7-py3-none-any.whl", hash = "sha256:ba8d3d39e1f392b9434365d53983b2fc6a458ae0496d2d9e103c15e1743ab66b"}, + {file = "sendgrid-6.9.7.tar.gz", hash = "sha256:fa30411c627690fecd0ef6b1d4e1783f2d0272aa14b5fffb133ebd1e31114f16"}, +] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, @@ -940,14 +887,13 @@ sqlalchemy = [ {file = "SQLAlchemy-1.4.37-cp39-cp39-win_amd64.whl", hash = "sha256:c37885f83b59e248bebe2b35beabfbea398cb40960cdc6d3a76eac863d4e1938"}, {file = "SQLAlchemy-1.4.37.tar.gz", hash = "sha256:3688f92c62db6c5df268e2264891078f17ecb91e3141b400f2e28d0f75796dea"}, ] +starkbank-ecdsa = [ + {file = "starkbank-ecdsa-2.0.3.tar.gz", hash = "sha256:73b62b1b3de54bbaa05dedb1a2d951c033432bb074de899e19d4a96a36b21df6"}, +] tomli = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -urllib3 = [ - {file = "urllib3-1.26.9-py2.py3-none-any.whl", hash = "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14"}, - {file = "urllib3-1.26.9.tar.gz", hash = "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"}, -] wcwidth = [ {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, diff --git a/bode/pyproject.toml b/bode/pyproject.toml index 2d5d90b..7c63503 100644 --- a/bode/pyproject.toml +++ b/bode/pyproject.toml @@ -23,8 +23,8 @@ psycopg2 = "^2.9.3" flake8-print = "^4.0.0" python-dateutil = "^2.8.2" gunicorn = "^20.1.0" -mailjet-rest = "^1.3.4" schedule = "^1.1.0" +sendgrid = "^6.9.7" [tool.poetry.dev-dependencies] pytest = "^5.2" From 1253fccb077d75a08cffea50d708c2e6658cabea Mon Sep 17 00:00:00 2001 From: gregori0o Date: Fri, 17 Jun 2022 19:44:50 +0200 Subject: [PATCH 3/3] refactor: Remove unnecesary line. --- bode/bode/mail_service/sending.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/bode/bode/mail_service/sending.py b/bode/bode/mail_service/sending.py index 0e18585..4171321 100644 --- a/bode/bode/mail_service/sending.py +++ b/bode/bode/mail_service/sending.py @@ -28,9 +28,6 @@ def send_notification(address, title, due_date, link): client.send(message) -send_notification - - def start_notify(app): def check_task_to_notify(): nowutc = datetime.utcnow().replace(second=0, microsecond=0)