Skip to content

Commit

Permalink
Release notes for 0.21.0 (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio authored Jul 2, 2024
1 parent a9d5bff commit 8a9178e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
21 changes: 17 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Changes
=======

Unreleased
----------
0.21.0 (2024-07-02)
-------------------

* 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:

Expand Down Expand Up @@ -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 <session-pools>`.

* 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)
-------------------
Expand Down
14 changes: 7 additions & 7 deletions scrapy_zyte_api/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,20 +276,20 @@ 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 <session-init>`,
e.g.
the default implementation returns an empty :class:`dict`, e.g.
.. code-block:: python
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
<session-init>`.
You should only override this method if you need a location to be
used even when no location is specified through request metadata or
Expand Down

0 comments on commit 8a9178e

Please sign in to comment.