From eb7c1c91333d9a32ff741314013c425519877a81 Mon Sep 17 00:00:00 2001 From: Aniket Sarkar <46404058+marktennyson@users.noreply.github.com> Date: Sat, 16 Apr 2022 01:42:16 +0530 Subject: [PATCH 1/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bf5760e..06dcd85 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Flask-Mailing adds SMTP mail sending to your Flask applications __The key features are:__ -- Most of the Apis are very familiar with `Flask-Mail` module. +- Most of the Apis are very similar to `Flask-Mail` module. - sending emails with either with Flask or using asyncio module - sending files either from form-data or files from server - Using Jinja2 HTML Templates @@ -110,4 +110,4 @@ Before you start please read [CONTRIBUTING](https://github.com/marktennyson/flas # 📝 LICENSE -[MIT](LICENSE) \ No newline at end of file +[MIT](LICENSE) From 9f4859697dad99fba37cdc89ee91f2b3874e1b62 Mon Sep 17 00:00:00 2001 From: ahmetkurukose Date: Tue, 26 Jul 2022 10:03:00 +0300 Subject: [PATCH 2/6] small typo fix --- docs/example.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/example.md b/docs/example.md index 02c9e28..9962b74 100644 --- a/docs/example.md +++ b/docs/example.md @@ -1,6 +1,6 @@ # Example -## Sending emails using Falsk-Email +## Sending emails using Flask-Mailing ## List of Examples @@ -325,4 +325,4 @@ print(who_is.is_dispasoble()) # check email is disposable or not print(who_is.check_mx_record()) # check domain mx records print(who_is.free_check) # check email domain is free or not -``` \ No newline at end of file +``` From 9a9de3633b4cab3f63d5078f2d9ac02655f6a485 Mon Sep 17 00:00:00 2001 From: Aniket Sarkar <46404058+marktennyson@users.noreply.github.com> Date: Tue, 2 Aug 2022 12:38:32 +0530 Subject: [PATCH 3/6] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 06dcd85..0a6bdda 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,8 @@ Thanks goes to these wonderful people ([🚧]):
Aniket Sarkar

💬 👀 🚧

Joshua Kinslow


Alexandre Gramfort

+
+ahmetkurukose

From f15bc04c3533c94f274e088585899ed722accb61 Mon Sep 17 00:00:00 2001 From: Aniket Sarkar <46404058+marktennyson@users.noreply.github.com> Date: Mon, 9 Jan 2023 12:20:01 +0000 Subject: [PATCH 4/6] Bump version 0.2.0 => 0.2.1 --- CHANGELOG.md | 7 ++++++- flask_mailing/utils/email_check.py | 25 +++++++++++++++++++++++-- setup.py | 2 +- tests/conftest.py | 20 +++++++++----------- tox.ini | 3 ++- 5 files changed, 41 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edd16f1..9565858 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,4 +46,9 @@ - `Added` `send_mail`, `send_mass_mail` methods very similar to `Django` or `Flask-Mailman`. - `Added` more docstrings for better understanding of all the apis. - `Added` few more test cases. -- `Fixed` major bug at `MAIL_START_TLS`/`MAIL_START_SSL` configuration at `ConnectionConfig`. \ No newline at end of file +- `Fixed` major bug at `MAIL_START_TLS`/`MAIL_START_SSL` configuration at `ConnectionConfig`. + +## 0.2.1 +- `Fixed` aioredis issue with python 3.11. +- `Fixed` httpx library issue. +- `Fixed` fakeredis issue. \ No newline at end of file diff --git a/flask_mailing/utils/email_check.py b/flask_mailing/utils/email_check.py index 028bb2d..3f57319 100644 --- a/flask_mailing/utils/email_check.py +++ b/flask_mailing/utils/email_check.py @@ -2,10 +2,22 @@ from abc import ABC, abstractmethod from typing import Any, List, Set -import aioredis + import dns.exception import dns.resolver -import httpx + +try: + import aioredis + redis_lib = True +except: + redis_lib = False + +try: + import httpx + request_lib = True +except: + request_lib = False + from pydantic import EmailStr from .errors import ApiError, DBProvaiderError @@ -83,6 +95,15 @@ def __init__( redis_pass: str = None, **options: dict, ): + if not redis_lib: + raise ImportError( + 'You must install aioredis from https://pypi.org/project/aioredis in order to run functionality' + ) + + if not request_lib: + raise ImportError( + 'You must install httpx from https://pypi.org/project/httpx in order to run functionality' + ) self.source = ( source diff --git a/setup.py b/setup.py index 1619fc3..882850e 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ find_packages ) -VERSION = (0, 2, 0) +VERSION = (0, 2, 1) AUTHOR = "Aniket Sarkar" AUTHOR_EMAIL = "aniketsarkar@yahoo.com" diff --git a/tests/conftest.py b/tests/conftest.py index 4f514d8..7ca5185 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,7 @@ from pathlib import Path -import fakeredis.aioredis import pytest +import fakeredis.aioredis from flask import Flask from flask_mailing.utils import DefaultChecker @@ -14,16 +14,14 @@ def default_checker(): del test -# @pytest.fixture -# @pytest.mark.asyncio -# async def redis_checker(scope="redis_config"): -# test = DefaultChecker(db_provider="redis") -# test.redis_client = await aioredis.create_redis_pool(encoding="UTF-8") -# await test.init_redis() -# yield test -# await test.redis_client.flushall() -# await test.close_connections() - +@pytest.fixture +@pytest.mark.asyncio +async def redis_checker(scope='redis_config'): + test = DefaultChecker(db_provider='redis') + test.redis_client = fakeredis.aioredis.FakeRedis() + yield test + await test.redis_client.flushall() + await test.close_connections() @pytest.fixture @pytest.mark.asyncio diff --git a/tox.ini b/tox.ini index 416fac3..72462df 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py{36,37,38,39, 310} +envlist = py{36,37,38,39, 310, 311} ; skipsdist = True ; recreate = True skip_missing_interpreters = true @@ -19,6 +19,7 @@ basepython = py38: python3.8 py39: python3.9 py310: python3.10 + py311: python3.11 platform = mylinux: linux mymacos: darwin From dabbebd7e31a16a33bad3d71d50761fc51d453c5 Mon Sep 17 00:00:00 2001 From: Aniket Sarkar <46404058+marktennyson@users.noreply.github.com> Date: Mon, 9 Jan 2023 12:27:44 +0000 Subject: [PATCH 5/6] remove fake redis unit test --- tests/conftest.py | 18 +++++++------- tests/test_redis_config.py | 48 +++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 7ca5185..2833eb1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,7 @@ from pathlib import Path import pytest -import fakeredis.aioredis +# import fakeredis.aioredis from flask import Flask from flask_mailing.utils import DefaultChecker @@ -14,14 +14,14 @@ def default_checker(): del test -@pytest.fixture -@pytest.mark.asyncio -async def redis_checker(scope='redis_config'): - test = DefaultChecker(db_provider='redis') - test.redis_client = fakeredis.aioredis.FakeRedis() - yield test - await test.redis_client.flushall() - await test.close_connections() +# @pytest.fixture +# @pytest.mark.asyncio +# async def redis_checker(scope='redis_config'): +# test = DefaultChecker(db_provider='redis') +# test.redis_client = fakeredis.aioredis.FakeRedis() +# yield test +# await test.redis_client.flushall() +# await test.close_connections() @pytest.fixture @pytest.mark.asyncio diff --git a/tests/test_redis_config.py b/tests/test_redis_config.py index bd67eb8..4c712ec 100644 --- a/tests/test_redis_config.py +++ b/tests/test_redis_config.py @@ -1,34 +1,34 @@ -import pytest +# import pytest -@pytest.mark.asyncio -async def test_redis_checker(redis_checker): +# @pytest.mark.asyncio +# async def test_redis_checker(redis_checker): - redis_checker.TEMP_EMAIL_DOMAINS = [] - redis_checker.BLOCKED_ADDRESSES = {} - redis_checker.BLOCKED_DOMAINS = {} - email = "test_me@hotmail.com" - domain = email.split("@")[-1] +# redis_checker.TEMP_EMAIL_DOMAINS = [] +# redis_checker.BLOCKED_ADDRESSES = {} +# redis_checker.BLOCKED_DOMAINS = {} +# email = "test_me@hotmail.com" +# domain = email.split("@")[-1] - assert await redis_checker.is_dispasoble(email) is False - assert await redis_checker.is_blocked_domain(domain) is False - assert await redis_checker.is_blocked_address(email) is False - assert await redis_checker.check_mx_record(domain) is True +# assert await redis_checker.is_dispasoble(email) is False +# assert await redis_checker.is_blocked_domain(domain) is False +# assert await redis_checker.is_blocked_address(email) is False +# assert await redis_checker.check_mx_record(domain) is True - await redis_checker.add_temp_domain([domain]) +# await redis_checker.add_temp_domain([domain]) - assert await redis_checker.is_dispasoble(email) is True - assert await redis_checker.is_blocked_domain(domain) is False - assert await redis_checker.is_blocked_address(email) is False - assert await redis_checker.check_mx_record(domain) is True +# assert await redis_checker.is_dispasoble(email) is True +# assert await redis_checker.is_blocked_domain(domain) is False +# assert await redis_checker.is_blocked_address(email) is False +# assert await redis_checker.check_mx_record(domain) is True - await redis_checker.blacklist_add_domain(domain) +# await redis_checker.blacklist_add_domain(domain) - assert await redis_checker.is_blocked_domain(domain) is True - assert await redis_checker.is_blocked_address(email) is False - assert await redis_checker.check_mx_record(domain) is True +# assert await redis_checker.is_blocked_domain(domain) is True +# assert await redis_checker.is_blocked_address(email) is False +# assert await redis_checker.check_mx_record(domain) is True - await redis_checker.blacklist_add_email(email) +# await redis_checker.blacklist_add_email(email) - assert await redis_checker.is_blocked_address(email) is True - assert await redis_checker.check_mx_record(domain) is True +# assert await redis_checker.is_blocked_address(email) is True +# assert await redis_checker.check_mx_record(domain) is True From 6222f1b9dc41e32a582cd130264bd993e6c3f879 Mon Sep 17 00:00:00 2001 From: Aniket Sarkar <46404058+marktennyson@users.noreply.github.com> Date: Wed, 11 Jan 2023 09:55:52 +0000 Subject: [PATCH 6/6] changed the changelog.md text --- CHANGELOG.md | 3 +-- tests/conftest.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9565858..8025282 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,5 +50,4 @@ ## 0.2.1 - `Fixed` aioredis issue with python 3.11. -- `Fixed` httpx library issue. -- `Fixed` fakeredis issue. \ No newline at end of file +- `Fixed` httpx library issue. \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index 2833eb1..d030d02 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,14 +23,14 @@ def default_checker(): # await test.redis_client.flushall() # await test.close_connections() -@pytest.fixture -@pytest.mark.asyncio -async def redis_checker(scope="redis_config"): - test = DefaultChecker(db_provider="redis") - test.redis_client = fakeredis.aioredis.FakeRedis() - yield test - await test.redis_client.flushall() - await test.close_connections() +# @pytest.fixture +# @pytest.mark.asyncio +# async def redis_checker(scope="redis_config"): +# test = DefaultChecker(db_provider="redis") +# test.redis_client = fakeredis.aioredis.FakeRedis() +# yield test +# await test.redis_client.flushall() +# await test.close_connections() @pytest.fixture(autouse=True)