diff --git a/aiogram/webhook/aiohttp_server.py b/aiogram/webhook/aiohttp_server.py index 6b01305e53..afb7d89c20 100644 --- a/aiogram/webhook/aiohttp_server.py +++ b/aiogram/webhook/aiohttp_server.py @@ -70,7 +70,7 @@ def ip_filter_middleware( async def _ip_filter_middleware(request: web.Request, handler: Handler) -> Any: ip_address, accept = check_ip(ip_filter=ip_filter, request=request) if not accept: - loggers.webhook.warning(f"Blocking request from an unauthorized IP: {ip_address}") + loggers.webhook.warning("Blocking request from an unauthorized IP: %s", ip_address) raise web.HTTPUnauthorized() return await handler(request) diff --git a/docs/dispatcher/filters/index.rst b/docs/dispatcher/filters/index.rst index ea5d940389..aba316c627 100644 --- a/docs/dispatcher/filters/index.rst +++ b/docs/dispatcher/filters/index.rst @@ -59,6 +59,8 @@ For example if you need to make simple text filter: Combining Filters ================= +.. versionadded:: 3.0b6 + In general, all filters can be combined in two ways @@ -72,7 +74,7 @@ If you specify multiple filters in a row, it will be checked with an "and" condi @.message(Text(startswith="show"), Text(endswith="example")) -Also, if you want to use two alternative ways to run the sage handler ("or" condition) +Also, if you want to use two alternative ways to run the same handler ("or" condition) you can register the handler twice or more times as you like .. code-block:: python diff --git a/docs/locale/en/LC_MESSAGES/dispatcher/filters/index.po b/docs/locale/en/LC_MESSAGES/dispatcher/filters/index.po index b7e98be5ad..5151825e0c 100644 --- a/docs/locale/en/LC_MESSAGES/dispatcher/filters/index.po +++ b/docs/locale/en/LC_MESSAGES/dispatcher/filters/index.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: aiogram \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-03 01:03+0300\n" +"POT-Creation-Date: 2022-10-18 01:50+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -127,44 +127,52 @@ msgstr "" msgid "For example if you need to make simple text filter:" msgstr "" -#: ../../dispatcher/filters/index.rst:58 +#: ../../dispatcher/filters/index.rst:60 msgid "Combining Filters" msgstr "" -#: ../../dispatcher/filters/index.rst:60 +#: ../../dispatcher/filters/index.rst:62 msgid "In general, all filters can be combined in two ways" msgstr "" -#: ../../dispatcher/filters/index.rst:64 +#: ../../dispatcher/filters/index.rst:66 msgid "Recommended way" msgstr "" -#: ../../dispatcher/filters/index.rst:66 +#: ../../dispatcher/filters/index.rst:68 msgid "" "If you specify multiple filters in a row, it will be checked with an " "\"and\" condition:" msgstr "" -#: ../../dispatcher/filters/index.rst:73 +#: ../../dispatcher/filters/index.rst:75 msgid "" -"Also, if you want to use two alternative ways to run the sage handler " +"Also, if you want to use two alternative ways to run the same handler " "(\"or\" condition) you can register the handler twice or more times as " "you like" msgstr "" -#: ../../dispatcher/filters/index.rst:82 +#: ../../dispatcher/filters/index.rst:84 msgid "" "Also sometimes you will need to invert the filter result, for example you" " have an *IsAdmin* filter and you want to check if the user is not an " "admin" msgstr "" -#: ../../dispatcher/filters/index.rst:91 +#: ../../dispatcher/filters/index.rst:93 msgid "Another possible way" msgstr "" -#: ../../dispatcher/filters/index.rst:93 +#: ../../dispatcher/filters/index.rst:95 msgid "" "An alternative way is to combine using special functions (:func:`and_f`, " ":func:`or_f`, :func:`invert_f` from :code:`aiogram.filters` module):" msgstr "" + +#~ msgid "" +#~ "Also, if you want to use two " +#~ "alternative ways to run the sage " +#~ "handler (\"or\" condition) you can " +#~ "register the handler twice or more " +#~ "times as you like" +#~ msgstr "" diff --git a/docs/locale/uk_UA/LC_MESSAGES/dispatcher/filters/index.po b/docs/locale/uk_UA/LC_MESSAGES/dispatcher/filters/index.po index b7e98be5ad..5151825e0c 100644 --- a/docs/locale/uk_UA/LC_MESSAGES/dispatcher/filters/index.po +++ b/docs/locale/uk_UA/LC_MESSAGES/dispatcher/filters/index.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: aiogram \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-03 01:03+0300\n" +"POT-Creation-Date: 2022-10-18 01:50+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -127,44 +127,52 @@ msgstr "" msgid "For example if you need to make simple text filter:" msgstr "" -#: ../../dispatcher/filters/index.rst:58 +#: ../../dispatcher/filters/index.rst:60 msgid "Combining Filters" msgstr "" -#: ../../dispatcher/filters/index.rst:60 +#: ../../dispatcher/filters/index.rst:62 msgid "In general, all filters can be combined in two ways" msgstr "" -#: ../../dispatcher/filters/index.rst:64 +#: ../../dispatcher/filters/index.rst:66 msgid "Recommended way" msgstr "" -#: ../../dispatcher/filters/index.rst:66 +#: ../../dispatcher/filters/index.rst:68 msgid "" "If you specify multiple filters in a row, it will be checked with an " "\"and\" condition:" msgstr "" -#: ../../dispatcher/filters/index.rst:73 +#: ../../dispatcher/filters/index.rst:75 msgid "" -"Also, if you want to use two alternative ways to run the sage handler " +"Also, if you want to use two alternative ways to run the same handler " "(\"or\" condition) you can register the handler twice or more times as " "you like" msgstr "" -#: ../../dispatcher/filters/index.rst:82 +#: ../../dispatcher/filters/index.rst:84 msgid "" "Also sometimes you will need to invert the filter result, for example you" " have an *IsAdmin* filter and you want to check if the user is not an " "admin" msgstr "" -#: ../../dispatcher/filters/index.rst:91 +#: ../../dispatcher/filters/index.rst:93 msgid "Another possible way" msgstr "" -#: ../../dispatcher/filters/index.rst:93 +#: ../../dispatcher/filters/index.rst:95 msgid "" "An alternative way is to combine using special functions (:func:`and_f`, " ":func:`or_f`, :func:`invert_f` from :code:`aiogram.filters` module):" msgstr "" + +#~ msgid "" +#~ "Also, if you want to use two " +#~ "alternative ways to run the sage " +#~ "handler (\"or\" condition) you can " +#~ "register the handler twice or more " +#~ "times as you like" +#~ msgstr "" diff --git a/poetry.lock b/poetry.lock index fb1f6c7434..2a2cb7107e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -341,13 +341,14 @@ testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packag [[package]] name = "incremental" -version = "21.3.0" -description = "A small library that versions your Python projects." +version = "22.10.0" +description = "\"A small library that versions your Python projects.\"" category = "dev" optional = false python-versions = "*" [package.extras] +mypy = ["click (>=6.0)", "mypy (==0.812)", "twisted (>=16.4.0)"] scripts = ["click (>=6.0)", "twisted (>=16.4.0)"] [[package]] @@ -863,7 +864,7 @@ python-versions = ">=3.6" [[package]] name = "Sphinx" -version = "5.2.3" +version = "5.3.0" description = "Python documentation generator" category = "dev" optional = false @@ -1522,8 +1523,8 @@ importlib-metadata = [ {file = "importlib_metadata-5.0.0.tar.gz", hash = "sha256:da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab"}, ] incremental = [ - {file = "incremental-21.3.0-py2.py3-none-any.whl", hash = "sha256:92014aebc6a20b78a8084cdd5645eeaa7f74b8933f70fa3ada2cfbd1e3b54321"}, - {file = "incremental-21.3.0.tar.gz", hash = "sha256:02f5de5aff48f6b9f665d99d48bfc7ec03b6e3943210de7cfc88856d755d6f57"}, + {file = "incremental-22.10.0-py2.py3-none-any.whl", hash = "sha256:b864a1f30885ee72c5ac2835a761b8fe8aa9c28b9395cacf27286602688d3e51"}, + {file = "incremental-22.10.0.tar.gz", hash = "sha256:912feeb5e0f7e0188e6f42241d2f450002e11bbc0937c65865045854c24c0bd0"}, ] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, @@ -1885,8 +1886,8 @@ soupsieve = [ {file = "soupsieve-2.3.2.post1.tar.gz", hash = "sha256:fc53893b3da2c33de295667a0e19f078c14bf86544af307354de5fcf12a3f30d"}, ] Sphinx = [ - {file = "Sphinx-5.2.3.tar.gz", hash = "sha256:5b10cb1022dac8c035f75767799c39217a05fc0fe2d6fe5597560d38e44f0363"}, - {file = "sphinx-5.2.3-py3-none-any.whl", hash = "sha256:7abf6fabd7b58d0727b7317d5e2650ef68765bbe0ccb63c8795fa8683477eaa2"}, + {file = "Sphinx-5.3.0.tar.gz", hash = "sha256:51026de0a9ff9fc13c05d74913ad66047e104f56a129ff73e174eb5c3ee794b5"}, + {file = "sphinx-5.3.0-py3-none-any.whl", hash = "sha256:060ca5c9f7ba57a08a1219e547b269fadf125ae25b06b9fa7f66768efb652d6d"}, ] sphinx-autobuild = [ {file = "sphinx-autobuild-2021.3.14.tar.gz", hash = "sha256:de1ca3b66e271d2b5b5140c35034c89e47f263f2cd5db302c9217065f7443f05"}, diff --git a/requirements/docs.txt b/requirements/docs.txt index d0cb75091b..8f14c3bde3 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -19,7 +19,7 @@ furo==2022.9.29 ; python_version >= "3.8" and python_version < "4.0" idna==3.4 ; python_version >= "3.8" and python_version < "4.0" imagesize==1.4.1 ; python_version >= "3.8" and python_version < "4.0" importlib-metadata==5.0.0 ; python_version >= "3.8" and python_version < "3.10" -incremental==21.3.0 ; python_version >= "3.8" and python_version < "4.0" +incremental==22.10.0 ; python_version >= "3.8" and python_version < "4.0" jinja2==3.1.2 ; python_version >= "3.8" and python_version < "4.0" livereload==2.6.3 ; python_version >= "3.8" and python_version < "4.0" magic-filter==1.0.9 ; python_version >= "3.8" and python_version < "4.0" @@ -46,7 +46,7 @@ sphinx-copybutton==0.5.0 ; python_version >= "3.8" and python_version < "4.0" sphinx-intl==2.0.1 ; python_version >= "3.8" and python_version < "4.0" sphinx-prompt==1.5.0 ; python_version >= "3.8" and python_version < "4.0" sphinx-substitution-extensions==2022.2.16 ; python_version >= "3.8" and python_version < "4.0" -sphinx==5.2.3 ; python_version >= "3.8" and python_version < "4.0" +sphinx==5.3.0 ; python_version >= "3.8" and python_version < "4.0" sphinxcontrib-applehelp==1.0.2 ; python_version >= "3.8" and python_version < "4.0" sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.8" and python_version < "4.0" sphinxcontrib-htmlhelp==2.0.0 ; python_version >= "3.8" and python_version < "4.0" diff --git a/tests/test_webhook/test_security.py b/tests/test_webhook/test_security.py index 73e00d296d..f5b05ba5f0 100644 --- a/tests/test_webhook/test_security.py +++ b/tests/test_webhook/test_security.py @@ -36,6 +36,7 @@ def test_default(self): assert len(ip_filter._allowed_ips) == 5116 assert "91.108.4.50" in ip_filter assert "149.154.160.20" in ip_filter + assert "91.108.6.79" in ip_filter @pytest.mark.parametrize( "ip,ip_range",