Skip to content

Commit

Permalink
nothing → off
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Dec 11, 2024
1 parent 04de424 commit 1255012
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/test_serp.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ def test_metadata():
"title": "Results Per Page",
},
"item_type": {
"default": "nothing",
"default": "off",
"description": (
"If specified, follow organic search result links, "
"and extract the selected data type from the target "
"pages. Spider output items will be of the specified "
"data type, not search engine results page items."
),
"enum": [
"nothing",
"off",
"article",
"articleList",
"forumThread",
Expand Down Expand Up @@ -758,7 +758,7 @@ def test_item_type_mappings():
# corresponding enum except for serp.
actual_keys = set(ITEM_TYPE_CLASSES)
expected_keys = set(
entry.value for entry in SerpItemType if entry != SerpItemType.nothing
entry.value for entry in SerpItemType if entry != SerpItemType.off
)
assert actual_keys == expected_keys

Expand Down
6 changes: 3 additions & 3 deletions zyte_spider_templates/spiders/serp.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class SerpResultsPerPageParam(BaseModel):

@document_enum
class SerpItemType(str, Enum):
nothing: str = "nothing"
off: str = "off"
"""
Do not follow result links.
"""
Expand Down Expand Up @@ -224,7 +224,7 @@ class SerpItemTypeParam(BaseModel):
"items will be of the specified data type, not search engine "
"results page items."
),
default=SerpItemType.nothing,
default=SerpItemType.off,
)


Expand Down Expand Up @@ -338,7 +338,7 @@ def parse_serp(self, response, page_number) -> Iterable[Union[Request, Serp]]:
next_url = add_or_replace_parameter(serp.url, "start", str(next_start))
yield self.get_serp_request(next_url, page_number=page_number + 1)

if self.args.item_type == SerpItemType.nothing:
if self.args.item_type == SerpItemType.off:
yield serp
return

Expand Down

0 comments on commit 1255012

Please sign in to comment.