Skip to content

Commit

Permalink
Simplify the description of the geolocation params
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Nov 13, 2024
1 parent 9a08850 commit 0b07703
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
6 changes: 1 addition & 5 deletions tests/test_ecommerce.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,7 @@ def test_metadata():
{"type": "null"},
],
"default": None,
"description": (
"ISO 3166-1 alpha-2 2-character string specified in "
"https://docs.zyte.com/zyte-api/usage/reference.html"
"#operation/extract/request/geolocation."
),
"description": ("Country of the IP addresses to use."),
"enumMeta": {
code: {
"title": GEOLOCATION_OPTIONS_WITH_CODE[code],
Expand Down
8 changes: 2 additions & 6 deletions tests/test_serp.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,14 @@ def test_metadata():
{"type": "null"},
],
"default": None,
"description": (
"ISO 3166-1 alpha-2 2-character string specified in "
"https://docs.zyte.com/zyte-api/usage/reference.html"
"#operation/extract/request/geolocation."
),
"description": ("Country of the IP addresses to use."),
"enumMeta": {
code: {
"title": GEOLOCATION_OPTIONS_WITH_CODE[code],
}
for code in sorted(Geolocation)
},
"title": "Geolocation (IP address)",
"title": "Geolocation (IP addresses)",
"enum": list(
sorted(GEOLOCATION_OPTIONS, key=GEOLOCATION_OPTIONS.__getitem__)
),
Expand Down
3 changes: 1 addition & 2 deletions zyte_spider_templates/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ class ExtractFromParam(BaseModel):
class GeolocationParam(BaseModel):
geolocation: Optional[Geolocation] = Field(
title="Geolocation",
description="ISO 3166-1 alpha-2 2-character string specified in "
"https://docs.zyte.com/zyte-api/usage/reference.html#operation/extract/request/geolocation.",
description="Country of the IP addresses to use.",
default=None,
json_schema_extra={
"enumMeta": {
Expand Down
5 changes: 2 additions & 3 deletions zyte_spider_templates/spiders/serp.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ class SerpGeolocationParam(BaseModel):
geolocation: Optional[Geolocation] = Field(
# The title, worded like this for contrast with gl, is the reason why
# ..params.GeolocationParam is not used.
title="Geolocation (IP address)",
description="ISO 3166-1 alpha-2 2-character string specified in "
"https://docs.zyte.com/zyte-api/usage/reference.html#operation/extract/request/geolocation.",
title="Geolocation (IP addresses)",
description="Country of the IP addresses to use.",
default=None,
json_schema_extra={
"enumMeta": {
Expand Down

0 comments on commit 0b07703

Please sign in to comment.