From 5d6a48200f458f1fb64c446ca0537a7883389cf2 Mon Sep 17 00:00:00 2001 From: danigm Date: Tue, 2 May 2023 21:28:50 +0200 Subject: [PATCH] Update update_query calls to work with latest yarl (#7260) This patch pass "{}" when params is "None" to the url.update_query to avoid setting the url params to None. Related to this change in yarl: https://github.com/aio-libs/yarl/commit/dd86b3435093b9ca251ecb7831346b92a3f16b25 Fix https://github.com/aio-libs/aiohttp/issues/7259 --------- Co-authored-by: Sam Bull (cherry picked from commit 2be9318dc95a26940e9095673ebcbbf77dfd087b) --- CHANGES/7259.bugfix | 1 + aiohttp/client.py | 3 ++- requirements/base.txt | 2 +- requirements/constraints.txt | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 CHANGES/7259.bugfix diff --git a/CHANGES/7259.bugfix b/CHANGES/7259.bugfix new file mode 100644 index 00000000000..0cc192e18b8 --- /dev/null +++ b/CHANGES/7259.bugfix @@ -0,0 +1 @@ +Fixed missing query in tracing method URLs when using ``yarl`` 1.9+. diff --git a/aiohttp/client.py b/aiohttp/client.py index d207819eb4b..75373991edf 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -425,6 +425,7 @@ async def _request( redirects = 0 history = [] version = self._version + params = params or {} # Merge with default headers and transform to CIMultiDict headers = self._prepare_headers(headers) @@ -659,7 +660,7 @@ async def _request( headers.pop(hdrs.AUTHORIZATION, None) url = parsed_url - params = None + params = {} resp.release() continue diff --git a/requirements/base.txt b/requirements/base.txt index 44b40403985..cc7c24571a8 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -13,4 +13,4 @@ charset-normalizer==2.0.12 frozenlist==1.3.1 gunicorn==20.1.0 uvloop==0.14.0; platform_system!="Windows" and implementation_name=="cpython" and python_version<"3.9" # MagicStack/uvloop#14 -yarl==1.8.1 +yarl==1.9.2 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 9c4872f301d..200b611fd0c 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -255,7 +255,7 @@ webcolors==1.11.1 # via blockdiag wheel==0.37.0 # via pip-tools -yarl==1.8.1 +yarl==1.9.2 # via -r requirements/base.txt zipp==3.10.0 # via importlib-metadata