Skip to content

Commit

Permalink
Improve the code example
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Jan 29, 2024
1 parent e128114 commit 3a206c1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/page-objects/additional-requests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ look like:
.. code-block:: python
import attrs
from web_poet import HttpClient, HttpError, WebPage, field
from zyte_common_items import Product
from web_poet import HttpClient, HttpError, field
from zyte_common_items import Image, ProductPage
@attrs.define
class ProductPage(WebPage[Product]):
class MyProductPage(ProductPage]):
http: HttpClient
@field
Expand All @@ -40,7 +40,8 @@ look like:
except HttpError:
return []
else:
return response.css(".product-images img::attr(src)").getall()
urls = response.css(".product-images img::attr(src)").getall()
return [Image(url=url) for url in urls]
.. warning::

Expand Down

0 comments on commit 3a206c1

Please sign in to comment.