vtexpy 0.0.0b21__py3-none-any.whl → 0.0.0b23__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.

Potentially problematic release.


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

@@ -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",
vtex/_api/orders.py CHANGED
@@ -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=2)
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)
vtex/_constants.py CHANGED
@@ -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,
vtex/_utils.py CHANGED
@@ -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
 
vtex/_vtex.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from functools import cached_property
2
- from typing import TYPE_CHECKING
2
+ from typing import TYPE_CHECKING, Any
3
3
 
4
4
  from ._config import VTEXConfig
5
5
  from ._logging import CLIENT_LOGGER
@@ -28,6 +28,12 @@ class VTEX:
28
28
  self.logger = CLIENT_LOGGER
29
29
  self.config = config
30
30
 
31
+ def with_config_overrides(self, **kwargs: Any) -> "VTEX":
32
+ if not kwargs:
33
+ return self
34
+
35
+ return VTEX(config=self.config.with_overrides(**kwargs))
36
+
31
37
  @cached_property
32
38
  def custom(self) -> "CustomAPI":
33
39
  from ._api import CustomAPI
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vtexpy
3
- Version: 0.0.0b21
3
+ Version: 0.0.0b23
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
@@ -4,10 +4,10 @@ vtex/_api/base.py,sha256=e3_rADPPmA7gafPBhLEL7B8a7yJjScMvcXU4pke2gGM,6840
4
4
  vtex/_api/catalog.py,sha256=0nYieUaEe2marzyDVpa23-XgtIXciK7n9rw8UqI9MU4,4661
5
5
  vtex/_api/checkout.py,sha256=AMhSzyjAu5sZUpqevRorV706yXjNafqGDgbnq2wxVpg,1693
6
6
  vtex/_api/custom.py,sha256=oW4dkHr1xuqVD7oby7ca9Qlhfzq7AeAIzcuKQ3eiUdc,2910
7
- vtex/_api/license_manager.py,sha256=DRHCOBmDTY6E4pSjcfZckTJD87bip_SXgu85qCNwwE0,2691
7
+ vtex/_api/license_manager.py,sha256=rzsQnxUT96EBmj3G6Fxy4pWH_wmLObGR6XsEhqTyr2c,2805
8
8
  vtex/_api/logistics.py,sha256=wKSbV2BnDxfhj04d3yQ39errOwml3zNYlXkqcIE2fqI,5052
9
9
  vtex/_api/master_data.py,sha256=JdMA_dWpbSY7TAJY5MobmQ7OsnoofJA60Qbx8IA6pe0,2046
10
- vtex/_api/orders.py,sha256=ea5ThbS1Offe9qrPJldM3g9uTPCw9KqdhR4XpIOj4y8,5127
10
+ vtex/_api/orders.py,sha256=klT9cMWTr0bjyyGCAVoFhYICi3vwpzWdbVMg9sS02y4,5136
11
11
  vtex/_api/payments_gateway.py,sha256=5XkxbXGI7OEQEaykL-y-3PKnfloy380fjUQ18Ctts9E,3804
12
12
  vtex/_api/promotions_and_taxes.py,sha256=yi9EDlOTop77_DqUF-E9SjblfgF4FyXyerA0_QZplJ4,1893
13
13
  vtex/_api/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -15,16 +15,16 @@ vtex/_api/types/catalog.py,sha256=O_qLoiGMyBxRdmxPclbbPobUxJSzViqzHiKf8tgfm_I,39
15
15
  vtex/_api/types/generic.py,sha256=m1lFTPeyBNi-K0shvK4uxE5SUyvhTTX_5Ls2VockkdI,344
16
16
  vtex/_api/types/license_manager.py,sha256=KYISnKdQ548g6x5cNieoaN6gh9C1LQVFv4sH-II1maI,1015
17
17
  vtex/_config.py,sha256=Uu2yaXlNh1zXjHkkEYnieCSWBsYr2DrIVH-K90mrbgY,11607
18
- vtex/_constants.py,sha256=YKuXRyKuGIZeJFc2k5tCKS2Y4DlMLSnEg17kv01qV_A,2069
18
+ vtex/_constants.py,sha256=jxg4SKInweW2JnVGQAc4PFXzgr7veZbEZVIoZJqUeUA,2161
19
19
  vtex/_dto.py,sha256=dq-MuKdIOJsrKDlHNBPnx337KusCM2LsO7HIvikCN0Y,6439
20
20
  vtex/_exceptions.py,sha256=yglSMmPy4oYWU65oGY1XWA1CbmW1MJO8K-bGYIjoXeg,2127
21
21
  vtex/_logging.py,sha256=C1h6Ta1EoXNPdP4U64-3iRCE0Qu-u6XLzSbyBKxkEFg,2226
22
22
  vtex/_sentinels.py,sha256=HLkYBJVHTx9GoyACPO1SuINaGlU2YiqOPuFXUa7iG8A,1120
23
23
  vtex/_types.py,sha256=xrqHzmrc0IhE5fc1aGf0StCm3BQbVFyk3LG4Hd7Wd2Q,631
24
- vtex/_utils.py,sha256=avSFE3v-HaUrof6JBzyspqA-eDrfOF5hnJT-KlRB0_8,3425
25
- vtex/_vtex.py,sha256=Vt-ERteT70vpXHpe2Q4VlkR5qpz_AS_Ni2OsS0hgDZs,2003
24
+ vtex/_utils.py,sha256=slBhhZN3h2S_qopVLGP0MS6nTfsoOcsqaOhLwbCiFwQ,3104
25
+ vtex/_vtex.py,sha256=yr8ICPX0gDpPdcoSDJaokMuwFZWWEQ7Wi8z6XibYdos,2184
26
26
  vtex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- vtexpy-0.0.0b21.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
28
- vtexpy-0.0.0b21.dist-info/METADATA,sha256=Yn2Z4La165KUdplhuQY-jPPgvvoprMYPzVm5yFEW334,3453
29
- vtexpy-0.0.0b21.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
30
- vtexpy-0.0.0b21.dist-info/RECORD,,
27
+ vtexpy-0.0.0b23.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
28
+ vtexpy-0.0.0b23.dist-info/METADATA,sha256=iPRJUEiDPtWBvrKfoBfvCfEZ4rJcdYylHEr-PnhGdJM,3493
29
+ vtexpy-0.0.0b23.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
30
+ vtexpy-0.0.0b23.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 1.9.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any