From 54fae45f6481730c138e70b902ca863df013c04c Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Thu, 26 Sep 2024 17:40:13 +0500 Subject: [PATCH] Release notes for 0.23.0. --- CHANGES.rst | 6 ++++++ docs/reference/inputs.rst | 2 ++ docs/usage/scrapy-poet.rst | 9 +++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index dbadc067..bcd5f4b6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changes ======= +0.23.0 (YYYY-MM-DD) +------------------- + +* Added support for :ref:`custom attribute extraction `. +* Added the :class:`~scrapy_zyte_api.LocationSessionConfig` class. + 0.22.1 (2024-08-30) ------------------- diff --git a/docs/reference/inputs.rst b/docs/reference/inputs.rst index 2d08cf72..f3e44901 100644 --- a/docs/reference/inputs.rst +++ b/docs/reference/inputs.rst @@ -60,3 +60,5 @@ Built-in input annotations :members: .. autofunction:: scrapy_zyte_api.actions + +.. autofunction:: scrapy_zyte_api.custom_attrs diff --git a/docs/usage/scrapy-poet.rst b/docs/usage/scrapy-poet.rst index 548d83de..9f3e3b8d 100644 --- a/docs/usage/scrapy-poet.rst +++ b/docs/usage/scrapy-poet.rst @@ -137,9 +137,9 @@ Custom attribute extraction --------------------------- You can request custom attribute extraction by using either a -:class:`scrapy_zyte_api.CustomAttributes` dependency (if you need both the +:class:`zyte_common_items.CustomAttributes` dependency (if you need both the attribute values and the attribute extraction metadata) or a -:class:`scrapy_zyte_api.CustomAttributesValues` dependency (if you only need +:class:`zyte_common_items.CustomAttributesValues` dependency (if you only need the values). You need to annotate it with input data as a dictionary and, if needed, a dictionary with extraction options. You should use the :func:`scrapy_zyte_api.custom_attrs` function to create the annotation: @@ -148,7 +148,8 @@ needed, a dictionary with extraction options. You should use the from typing import Annotated - from scrapy_zyte_api import CustomAttributes, custom_attrs + from scrapy_zyte_api import custom_attrs + from zyte_common_items import CustomAttributes @attrs.define @@ -168,7 +169,7 @@ You can then access the results as the dependency value: def parse_page(self, response: DummyResponse, page: MyPageObject): ... - for k, v in page.custom_attributes.items(): + for k, v in page.custom_attributes.values.items(): ...