From 3285732b22e7d795bc0c9783e121eb684c2bac7c Mon Sep 17 00:00:00 2001 From: TAHRI Ahmed R Date: Tue, 9 Jul 2024 15:42:59 +0100 Subject: [PATCH] :bug: fix dummylock injected into asyncsession for cookies (#137) fix #136 --- HISTORY.md | 6 ++++++ pyproject.toml | 2 +- src/niquests/__version__.py | 4 ++-- src/niquests/structures.py | 8 +++++++- tests/test_async.py | 6 ++++++ 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 29df37445a..4a4a850bce 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,12 @@ Release History =============== +3.7.2 (2024-07-09) +------------------ + +**Fixed** +- DummyLock injected into RequestsCookieJar is not fully compatible, thus breaking AsyncSession on certain scenario. (#136) + 3.7.1 (2024-07-07) ------------------ diff --git a/pyproject.toml b/pyproject.toml index 1bc968e675..493c78a2ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ dynamic = ["version"] dependencies = [ "charset_normalizer>=2,<4", "idna>=2.5,<4", - "urllib3.future>=2.8.900,<3", + "urllib3.future>=2.8.902,<3", "wassima>=1.0.1,<2", "kiss_headers>=2,<4", ] diff --git a/src/niquests/__version__.py b/src/niquests/__version__.py index 09bc11c6b5..684b315a1c 100644 --- a/src/niquests/__version__.py +++ b/src/niquests/__version__.py @@ -9,9 +9,9 @@ __url__: str = "https://niquests.readthedocs.io" __version__: str -__version__ = "3.7.1" +__version__ = "3.7.2" -__build__: int = 0x030701 +__build__: int = 0x030702 __author__: str = "Kenneth Reitz" __author_email__: str = "me@kennethreitz.org" __license__: str = "Apache-2.0" diff --git a/src/niquests/structures.py b/src/niquests/structures.py index 8352759425..6b95610486 100644 --- a/src/niquests/structures.py +++ b/src/niquests/structures.py @@ -254,4 +254,10 @@ def __enter__(self): return self def __exit__(self, exc_type, exc_val, exc_tb): - return + pass + + def acquire(self): + pass + + def release(self): + pass diff --git a/tests/test_async.py b/tests/test_async.py index bf2c396519..20ae8321a3 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -35,6 +35,12 @@ async def test_awaitable_redirect_chain_stream(self): assert resp.status_code == 200 assert await resp.json() + async def test_async_session_cookie_dummylock(self): + async with AsyncSession() as s: + await s.get("https://pie.dev/cookies/set/hello/world") + assert len(s.cookies) + assert "hello" in s.cookies + async def test_concurrent_task_get(self): async def emit(): responses = []