From 14390c6ffc522a33e85e229ff595bfe27e5db7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Tue, 2 Jul 2024 09:15:25 +0200 Subject: [PATCH 1/2] Release notes for 0.21.0 --- CHANGES.rst | 21 +++++++++++++++++---- scrapy_zyte_api/_session.py | 14 +++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 59ca7667..35e488a4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,11 +1,11 @@ Changes ======= -Unreleased ----------- +0.21.0 (2024-07-DD) +------------------- -* The precedence of session param settings, request metadata keys and session - config override methods has changed. +* **Backward-incompatible change:** The precedence of session param settings, + request metadata keys and session config override methods has changed. Before, priority from higher to lower was: @@ -35,6 +35,19 @@ Unreleased #. :meth:`~scrapy_zyte_api.SessionConfig.params` +* When using the :reqmeta:`zyte_api_session_params` or + :reqmeta:`zyte_api_session_location` request metadata keys, a different pool + ID is now generated by default based on their value. See + :meth:`~scrapy_zyte_api.SessionConfig.pool` for details. + +* The new :reqmeta:`zyte_api_session_pool` request metadata key allows + overriding the pool ID of a request. + +* Added :ref:`pool management documentation `. + +* Fixed some documentation examples where the parameters of the ``check`` + method of :setting:`ZYTE_API_SESSION_CHECKER` were in reverse order. + 0.20.0 (2024-06-26) ------------------- diff --git a/scrapy_zyte_api/_session.py b/scrapy_zyte_api/_session.py index 17c4f0a3..5245ac8a 100644 --- a/scrapy_zyte_api/_session.py +++ b/scrapy_zyte_api/_session.py @@ -276,9 +276,7 @@ def location(self, request: Request) -> Dict[str, str]: keys as described in :ref:`session-init`. When overriding this method, you should only return a custom value if - the default implementation returns an empty :class:`dict`, to avoid - breaking the :ref:`precedence chain that users expect `, - e.g. + the default implementation returns an empty :class:`dict`, e.g. .. code-block:: python @@ -286,10 +284,12 @@ def location(self, request: Request) -> Dict[str, str]: fallback = {"addressCountry": "US", "addressRegion": "NY", "postalCode": "10001"} return super().location(request) or fallback - .. note:: An implementation of :meth:`~scrapy_zyte_api.SessionConfig.location` - can technically override :reqmeta:`zyte_api_session_location` or - :setting:`ZYTE_API_SESSION_LOCATION`, but it is not recommended as it - breaks the precedence chain above that users may expect. + .. note:: An implementation of + :meth:`~scrapy_zyte_api.SessionConfig.location` can technically + override :reqmeta:`zyte_api_session_location` or + :setting:`ZYTE_API_SESSION_LOCATION`, but it is not recommended as + it breaks the :ref:`precedence chain that users expect + `. You should only override this method if you need a location to be used even when no location is specified through request metadata or From 37de3d0271294fe582f0bfa58bebf5fc3ffa6c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Tue, 2 Jul 2024 10:00:50 +0200 Subject: [PATCH 2/2] Set the release date --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 35e488a4..e61df16d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changes ======= -0.21.0 (2024-07-DD) +0.21.0 (2024-07-02) ------------------- * **Backward-incompatible change:** The precedence of session param settings,