vtexpy 0.0.0b20__tar.gz → 0.0.0b22__tar.gz

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.

Potentially problematic release.


This version of vtexpy might be problematic. Click here for more details.

Files changed (30) hide show
  1. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/PKG-INFO +6 -5
  2. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/pyproject.toml +7 -5
  3. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/custom.py +7 -13
  4. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/license_manager.py +9 -1
  5. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/orders.py +2 -2
  6. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_constants.py +9 -3
  7. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_utils.py +0 -16
  8. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/LICENSE +0 -0
  9. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/README.md +0 -0
  10. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/__init__.py +0 -0
  11. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/__init__.py +0 -0
  12. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/base.py +0 -0
  13. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/catalog.py +0 -0
  14. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/checkout.py +0 -0
  15. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/logistics.py +0 -0
  16. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/master_data.py +0 -0
  17. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/payments_gateway.py +0 -0
  18. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/promotions_and_taxes.py +0 -0
  19. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/types/__init__.py +0 -0
  20. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/types/catalog.py +0 -0
  21. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/types/generic.py +0 -0
  22. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_api/types/license_manager.py +0 -0
  23. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_config.py +0 -0
  24. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_dto.py +0 -0
  25. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_exceptions.py +0 -0
  26. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_logging.py +0 -0
  27. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_sentinels.py +0 -0
  28. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_types.py +0 -0
  29. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/_vtex.py +0 -0
  30. {vtexpy-0.0.0b20 → vtexpy-0.0.0b22}/vtex/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vtexpy
3
- Version: 0.0.0b20
3
+ Version: 0.0.0b22
4
4
  Summary: Unofficial VTEX API's Python SDK
5
5
  Home-page: https://github.com/lvieirajr/vtex-python
6
6
  License: Apache
@@ -25,11 +25,12 @@ Classifier: Programming Language :: Python :: 3.13
25
25
  Classifier: Topic :: Software Development :: Libraries
26
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
27
  Classifier: Typing :: Typed
28
- Requires-Dist: httpx (>=0.26,<1.0)
29
- Requires-Dist: pydantic (>=2.6,<3.0)
28
+ Requires-Dist: cachetools (>=5.0,<6.0)
29
+ Requires-Dist: httpx (>=0.17,<1.0)
30
+ Requires-Dist: pydantic (>=2.0,<3.0)
30
31
  Requires-Dist: python-dateutil (>=2.9,<3.0)
31
- Requires-Dist: tenacity (>=8.3,<10.0)
32
- Requires-Dist: typing-extensions (>=4.7,<5.0) ; python_version < "3.12"
32
+ Requires-Dist: tenacity (>=8.0,<10.0)
33
+ Requires-Dist: typing-extensions (>=3.10,<5.0) ; python_version < "3.12"
33
34
  Project-URL: Documentation, https://github.com/lvieirajr/vtex-python
34
35
  Project-URL: Repository, https://github.com/lvieirajr/vtex-python
35
36
  Description-Content-Type: text/markdown
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
5
5
  [tool.poetry]
6
6
  name = "vtexpy"
7
7
  description = "Unofficial VTEX API's Python SDK"
8
- version = "0.0.0b20"
8
+ version = "0.0.0b22"
9
9
  readme = "README.md"
10
10
  license = "Apache"
11
11
  authors = [
@@ -40,11 +40,12 @@ packages = [
40
40
 
41
41
  [tool.poetry.dependencies]
42
42
  python = ">=3.9,<3.14"
43
- httpx = {version = ">=0.26,<1.0"}
44
- pydantic = {version = ">=2.6,<3.0"}
43
+ cachetools = {version = ">=5.0,<6.0"}
44
+ httpx = {version = ">=0.17,<1.0"}
45
+ pydantic = {version = ">=2.0,<3.0"}
45
46
  python-dateutil = {version = ">=2.9,<3.0"}
46
- tenacity = {version = ">=8.3,<10.0"}
47
- typing-extensions = {version = ">=4.7,<5.0", markers = "python_version < \"3.12\""}
47
+ tenacity = {version = ">=8.0,<10.0"}
48
+ typing-extensions = {version = ">=3.10,<5.0", markers = "python_version < \"3.12\""}
48
49
 
49
50
  [tool.poetry.group.dev.dependencies]
50
51
  ipdb = {version = "*"}
@@ -58,6 +59,7 @@ pytest = {version = "*"}
58
59
  pytest-mock = {version = "*"}
59
60
  ruff = {version = "*"}
60
61
  setuptools = {version = "*"}
62
+ types-cachetools = {version = "*"}
61
63
  types-decorator = {version = "*"}
62
64
  types-python-dateutil = {version = "*"}
63
65
  types-six = {version = "*"}
@@ -67,28 +67,22 @@ class CustomAPI(BaseAPI):
67
67
  return self.client.license_manager.get_account().data["sites"]
68
68
 
69
69
  def get_main_seller(self) -> Seller:
70
- for seller in self.client.catalog.list_sellers().items:
71
- if seller["seller_type"] == 1 and seller["seller_id"] == "1":
70
+ for seller in self.client.catalog.list_sellers(seller_type=1).items:
71
+ if seller["seller_id"] == "1":
72
72
  return seller
73
73
 
74
74
  raise VTEXError("Could not find main seller")
75
75
 
76
- def list_market_place_sellers(
77
- self,
78
- include_inactive: bool = False,
79
- include_main: bool = False,
80
- ) -> List[Seller]:
76
+ def list_market_place_sellers(self, include_inactive: bool = False) -> List[Seller]:
81
77
  return [
82
78
  seller
83
- for seller in self.client.catalog.list_sellers().items
84
- if seller["seller_type"] == 1
85
- and (include_main or seller["seller_id"] != "1")
86
- and (include_inactive or seller["is_active"])
79
+ for seller in self.client.catalog.list_sellers(seller_type=1).items
80
+ if (include_inactive or seller["is_active"]) and seller["seller_id"] != "1"
87
81
  ]
88
82
 
89
83
  def list_franchise_sellers(self, include_inactive: bool = False) -> List[Seller]:
90
84
  return [
91
85
  seller
92
- for seller in self.client.catalog.list_sellers().items
93
- if seller["seller_type"] == 2 and (include_inactive or seller["is_active"])
86
+ for seller in self.client.catalog.list_sellers(seller_type=2).items
87
+ if include_inactive or seller["is_active"]
94
88
  ]
@@ -1,6 +1,13 @@
1
1
  from typing import Any, List, Union
2
2
 
3
- from .._constants import LIST_ROLES_MAX_PAGE_SIZE, LIST_ROLES_START_PAGE, MIN_PAGE_SIZE
3
+ from cachetools import TTLCache, cached
4
+
5
+ from .._constants import (
6
+ HOUR,
7
+ LIST_ROLES_MAX_PAGE_SIZE,
8
+ LIST_ROLES_START_PAGE,
9
+ MIN_PAGE_SIZE,
10
+ )
4
11
  from .._dto import VTEXDataResponse, VTEXItemsResponse, VTEXPaginatedItemsResponse
5
12
  from .._sentinels import UNDEFINED, UndefinedSentinel
6
13
  from .._types import OrderingDirectionType
@@ -16,6 +23,7 @@ class LicenseManagerAPI(BaseAPI):
16
23
 
17
24
  ENVIRONMENT = "vtexcommercestable"
18
25
 
26
+ @cached(TTLCache(maxsize=1024, ttl=HOUR))
19
27
  def get_account(self, **kwargs: Any) -> VTEXDataResponse[GetAccountData]:
20
28
  return self._request(
21
29
  method="GET",
@@ -11,7 +11,7 @@ from .._constants import (
11
11
  from .._dto import VTEXDataResponse, VTEXItemsResponse, VTEXPaginatedItemsResponse
12
12
  from .._sentinels import UNDEFINED, UndefinedSentinel
13
13
  from .._types import OrderingDirectionType
14
- from .._utils import now, years_ago
14
+ from .._utils import now
15
15
  from .base import BaseAPI
16
16
 
17
17
 
@@ -60,7 +60,7 @@ class OrdersAPI(BaseAPI):
60
60
 
61
61
  if creation_date_from is not UNDEFINED or creation_date_to is not UNDEFINED:
62
62
  if not isinstance(creation_date_from, datetime):
63
- creation_date_from = years_ago(years=4)
63
+ creation_date_from = self.client.custom.get_creation_date()
64
64
 
65
65
  if not isinstance(creation_date_to, datetime):
66
66
  creation_date_to = now() + timedelta(minutes=1)
@@ -1,5 +1,11 @@
1
1
  from logging import INFO, WARNING
2
2
 
3
+ # Timing
4
+ SECOND = 1.0
5
+ MINUTE = 60.0 * SECOND
6
+ HOUR = 60.0 * MINUTE
7
+ DAY = 24.0 * HOUR
8
+
3
9
  # Vtex Auth
4
10
  APP_KEY_HEADER = "X-VTEX-API-AppKey"
5
11
  APP_TOKEN_HEADER = "X-VTEX-API-AppToken" # noqa: S105
@@ -22,10 +28,10 @@ LOG_3XX_ENV_VAR = "VTEX_LOG_3XX"
22
28
  LOG_4XX_ENV_VAR = "VTEX_LOG_4XX"
23
29
  LOG_5XX_ENV_VAR = "VTEX_LOG_5XX"
24
30
 
25
- DEFAULT_TIMEOUT = 60.0
31
+ DEFAULT_TIMEOUT = MINUTE
26
32
  DEFAULT_RETRY_ATTEMPTS = 5
27
- DEFAULT_RETRY_BACKOFF_MIN = 1.0
28
- DEFAULT_RETRY_BACKOFF_MAX = 64.0
33
+ DEFAULT_RETRY_BACKOFF_MIN = SECOND
34
+ DEFAULT_RETRY_BACKOFF_MAX = MINUTE
29
35
  DEFAULT_RETRY_STATUSES = [
30
36
  401,
31
37
  407,
@@ -99,22 +99,6 @@ def now(use_tz: bool = True, tz: Union[tzinfo, None] = None) -> datetime:
99
99
  return datetime.now(to_tzinfo(tz) if use_tz else None)
100
100
 
101
101
 
102
- def years_ago(
103
- years: int,
104
- use_tz: bool = True,
105
- tz: Union[tzinfo, None] = None,
106
- ) -> datetime:
107
- current_datetime = now(use_tz=use_tz, tz=tz)
108
-
109
- return current_datetime.replace(
110
- year=current_datetime.year - years,
111
- hour=0,
112
- minute=0,
113
- second=0,
114
- microsecond=0,
115
- )
116
-
117
-
118
102
  def redact_headers(headers: Mapping[str, str]) -> Dict[str, str]:
119
103
  redacted_headers = {}
120
104
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes