vtexpy 0.0.0b38__py3-none-any.whl → 0.0.0b40__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
vtex/_api/__init__.py CHANGED
@@ -8,3 +8,4 @@ from .orders import OrdersAPI
8
8
  from .payments_gateway import PaymentsGatewayAPI
9
9
  from .pricing import PricingAPI
10
10
  from .promotions_and_taxes import PromotionsAndTaxesAPI
11
+ from .search import SearchAPI
vtex/_api/catalog.py CHANGED
@@ -91,8 +91,8 @@ class CatalogAPI(BaseAPI):
91
91
 
92
92
  def list_categories(
93
93
  self,
94
- page: int = LIST_SKU_IDS_START_PAGE,
95
- page_size: int = LIST_SKU_IDS_MAX_PAGE_SIZE,
94
+ page: int = LIST_CATEGORIES_START_PAGE,
95
+ page_size: int = LIST_CATEGORIES_MAX_PAGE_SIZE,
96
96
  **kwargs: Any,
97
97
  ) -> VTEXPaginatedItemsResponse[Any, Any]:
98
98
  return self._request(
vtex/_api/search.py ADDED
@@ -0,0 +1,29 @@
1
+ from typing import Any, Union
2
+
3
+ from .._dto import VTEXDataResponse
4
+ from .base import BaseAPI
5
+
6
+
7
+ class SearchAPI(BaseAPI):
8
+ """
9
+ Client for the Search API.
10
+ https://developers.vtex.com/docs/api-reference/search-api
11
+ """
12
+
13
+ ENVIRONMENT = "vtexcommercestable"
14
+
15
+ def search_sku_offers(
16
+ self,
17
+ product_id: Union[int, str],
18
+ sku_id: Union[int, str],
19
+ **kwargs: Any,
20
+ ) -> VTEXDataResponse[Any]:
21
+ return self._request(
22
+ method="GET",
23
+ endpoint=(
24
+ f"/api/catalog_system/pub/products/offers/{product_id}/sku/{sku_id}"
25
+ ),
26
+ environment=self.ENVIRONMENT,
27
+ config=self.client.config.with_overrides(**kwargs),
28
+ response_class=VTEXDataResponse[Any],
29
+ )
vtex/_constants.py CHANGED
@@ -56,6 +56,10 @@ DEFAULT_LOG_5XX = WARNING
56
56
  # Generics
57
57
  MIN_PAGE_SIZE = 1
58
58
 
59
+ # Intelligent Search
60
+ INTELLIGENT_PRODUCT_SEARCH_START_PAGE = 1
61
+ INTELLIGENT_PRODUCT_SEARCH_MAX_PAGE_SIZE = 100
62
+
59
63
  # Catalog
60
64
  LIST_SKU_IDS_START_PAGE = 1
61
65
  LIST_SKU_IDS_MAX_PAGE_SIZE = 1_000
vtex/_dto.py CHANGED
@@ -91,6 +91,8 @@ class VTEXItemsResponse(VTEXDataResponse[DataType], Generic[DataType, ItemType])
91
91
  items = data["items"]
92
92
  elif isinstance(data, dict) and isinstance(data.get("data"), list):
93
93
  items = data["data"]
94
+ elif isinstance(data, dict) and isinstance(data.get("products"), list):
95
+ items = data["products"]
94
96
  else:
95
97
  raise ValueError(f"Not a valid items response: {data}")
96
98
 
@@ -135,6 +137,11 @@ class VTEXPagination(BaseModel):
135
137
  page_size = data["size"]
136
138
  pages = data["total_page"]
137
139
  page = data["page"]
140
+ elif isinstance(data, dict) and data.get("pagination"):
141
+ total = data["records_filtered"]
142
+ page_size = data["pagination"]["per_page"]
143
+ pages = data["pagination"]["count"]
144
+ page = data["pagination"]["current"]["index"]
138
145
  elif "rest-content-range" in response_headers:
139
146
  request_pagination = request_headers["rest-range"].split("=")[-1].split("-")
140
147
  response_pagination = response_headers["rest-content-range"].split(" ")[-1]
vtex/_vtex.py CHANGED
@@ -16,6 +16,7 @@ if TYPE_CHECKING:
16
16
  PaymentsGatewayAPI,
17
17
  PricingAPI,
18
18
  PromotionsAndTaxesAPI,
19
+ SearchAPI,
19
20
  )
20
21
 
21
22
 
@@ -94,3 +95,9 @@ class VTEX:
94
95
  from ._api import PromotionsAndTaxesAPI
95
96
 
96
97
  return PromotionsAndTaxesAPI(client=self)
98
+
99
+ @cached_property
100
+ def search(self) -> "SearchAPI":
101
+ from ._api import SearchAPI
102
+
103
+ return SearchAPI(client=self)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vtexpy
3
- Version: 0.0.0b38
3
+ Version: 0.0.0b40
4
4
  Summary: Unofficial VTEX API's Python SDK
5
5
  Project-URL: homepage, https://github.com/lvieirajr/vtex-python
6
6
  Project-URL: repository, https://github.com/lvieirajr/vtex-python
@@ -1,17 +1,17 @@
1
1
  vtex/__init__.py,sha256=SLnqpZa19ISSQ9LDaCVLDAj-OxFlgVkQyEknydu20VU,636
2
2
  vtex/_config.py,sha256=EhvVHgby0PY4rdIlKbWsH8y3fugDoxaQCCOLahzQY1w,12301
3
- vtex/_constants.py,sha256=Oijo8dlWaC9m_liGlqFMWdh0HN7pPtFs75sTA2CjJOA,2047
4
- vtex/_dto.py,sha256=6CSgQfQp94tA5M9rKxgWf_ftRyoZB804iABIpB5Ff6Y,6479
3
+ vtex/_constants.py,sha256=xf6xlpu9tvtRHGQXPp38WIvw5xQA3DDY8VVuD7Ogpd8,2158
4
+ vtex/_dto.py,sha256=78PamXGpmaSoGzh8yVDGpZPk_NBsPglzFilP8dDDKas,6866
5
5
  vtex/_exceptions.py,sha256=dNRhdk6k4capnsUSHPOKsvACwLfG8cwTNXltao3t344,2152
6
6
  vtex/_logging.py,sha256=zahPJIk10YvNs6qoNqhUy7OoDG7dr634CPwiGjT0aEk,2246
7
7
  vtex/_sentinels.py,sha256=HLkYBJVHTx9GoyACPO1SuINaGlU2YiqOPuFXUa7iG8A,1120
8
8
  vtex/_types.py,sha256=xrqHzmrc0IhE5fc1aGf0StCm3BQbVFyk3LG4Hd7Wd2Q,631
9
9
  vtex/_utils.py,sha256=GHNxlqBs73KXHN8Aejh7dT9dhFLhBk13EN-9nIEaimk,3413
10
- vtex/_vtex.py,sha256=IBPVQ__xiQGJEoht4oCnd-pAYKNJDrKoU06yieQL84o,2342
10
+ vtex/_vtex.py,sha256=HyA5qEzzXNn8LqyI2BFL2OODBN6XLtKqqXRCknIMYUA,2495
11
11
  vtex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- vtex/_api/__init__.py,sha256=2OarRhTDq1Oj65v7WkMr3Bi7EAnQMPm2Ypgv9flzE6c,385
12
+ vtex/_api/__init__.py,sha256=If5RrL74DVKisrllDNjMDrf-hGsgBe7uHu8xxXh1EnY,415
13
13
  vtex/_api/base.py,sha256=Pjww58gnM31C7Oo0AC_TNOcqLM8mSmfk2kQfnVyaQnQ,7079
14
- vtex/_api/catalog.py,sha256=UaVWI9Vhhu6wHejO851hVSDmcLUDtfwcnsGasZGEKiw,4661
14
+ vtex/_api/catalog.py,sha256=vfUHWd6lbRyivszzgIIexJB-bt2mpBLZLfQZAJAcngg,4667
15
15
  vtex/_api/checkout.py,sha256=ViFJq2GZRAA6yyjaFC3rz0oMYKxzBIsi8tzGKCWRxQ0,1693
16
16
  vtex/_api/custom.py,sha256=3yIwTj1Ikf30oq0GzdNz0P9APYxjBeoRvdlbh0rT9gs,2930
17
17
  vtex/_api/license_manager.py,sha256=GAdRpizeGUFem-up-SYNzehs5uBY0elTElJ9bEQUlFo,2805
@@ -21,11 +21,12 @@ vtex/_api/orders.py,sha256=XvT40L9_MDzzxGS45TOuqGLjk7HiPhUIp7aSs30GPmI,5161
21
21
  vtex/_api/payments_gateway.py,sha256=GbSsCUtYjzp0oL6reKjkG_F7TZCPN86xmbd8GX2C2U0,3804
22
22
  vtex/_api/pricing.py,sha256=gZX9MmUKsj0iPjJKT2-Ko9dzT6rZR_DR4ruqs1c9IdY,535
23
23
  vtex/_api/promotions_and_taxes.py,sha256=wtNxTrc36u10AMbOq2NMtOVp1HLzrBWxqJDmBYpdXXY,1893
24
+ vtex/_api/search.py,sha256=6PCe0lLqPgx8azk2zsV_D9kbmLF8OjQBD7giooADzAE,782
24
25
  vtex/_api/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
26
  vtex/_api/types/catalog.py,sha256=O_qLoiGMyBxRdmxPclbbPobUxJSzViqzHiKf8tgfm_I,394
26
27
  vtex/_api/types/generic.py,sha256=m1lFTPeyBNi-K0shvK4uxE5SUyvhTTX_5Ls2VockkdI,344
27
28
  vtex/_api/types/license_manager.py,sha256=KYISnKdQ548g6x5cNieoaN6gh9C1LQVFv4sH-II1maI,1015
28
- vtexpy-0.0.0b38.dist-info/METADATA,sha256=EQBUUi5vJFS_XPvM53nMqvDaYhagsbBi-CIIhD7t5vQ,3408
29
- vtexpy-0.0.0b38.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- vtexpy-0.0.0b38.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
31
- vtexpy-0.0.0b38.dist-info/RECORD,,
29
+ vtexpy-0.0.0b40.dist-info/METADATA,sha256=5-zfDw5rmSpxX58rzKO_MDlazaaJQEkdPmM8U4cErOY,3408
30
+ vtexpy-0.0.0b40.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
+ vtexpy-0.0.0b40.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
32
+ vtexpy-0.0.0b40.dist-info/RECORD,,