Skip to content

Commit

Permalink
Merge pull request #220 from scrapy-plugins/relnotes-0.23.0
Browse files Browse the repository at this point in the history
Release notes for 0.23.0.
  • Loading branch information
wRAR authored Sep 26, 2024
2 parents a2061e8 + 54fae45 commit 54c1010
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changes
=======

0.23.0 (YYYY-MM-DD)
-------------------

* Added support for :ref:`custom attribute extraction <custom-attrs>`.
* Added the :class:`~scrapy_zyte_api.LocationSessionConfig` class.

0.22.1 (2024-08-30)
-------------------

Expand Down
2 changes: 2 additions & 0 deletions docs/reference/inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ Built-in input annotations
:members:

.. autofunction:: scrapy_zyte_api.actions

.. autofunction:: scrapy_zyte_api.custom_attrs
9 changes: 5 additions & 4 deletions docs/usage/scrapy-poet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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():
...
Expand Down

0 comments on commit 54c1010

Please sign in to comment.