vtexpy 0.0.0b16__py3-none-any.whl → 0.0.0b17__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.
- vtex/__init__.py +2 -0
- vtex/_api/base.py +62 -39
- vtex/_api/catalog.py +26 -14
- vtex/_api/checkout.py +5 -6
- vtex/_api/custom.py +23 -14
- vtex/_api/license_manager.py +1 -1
- vtex/_api/logistics.py +14 -15
- vtex/_api/master_data.py +5 -5
- vtex/_api/orders.py +9 -9
- vtex/_api/payments_gateway.py +16 -17
- vtex/_api/promotions_and_taxes.py +8 -9
- vtex/_api/types/catalog.py +21 -0
- vtex/_api/types/generic.py +4 -4
- vtex/_api/types/license_manager.py +13 -7
- vtex/_config.py +251 -391
- vtex/_constants.py +18 -6
- vtex/_dto.py +22 -17
- vtex/_logging.py +28 -6
- vtex/_types.py +18 -3
- vtex/_utils.py +16 -20
- vtex/_vtex.py +4 -30
- {vtexpy-0.0.0b16.dist-info → vtexpy-0.0.0b17.dist-info}/METADATA +29 -25
- vtexpy-0.0.0b17.dist-info/RECORD +31 -0
- vtexpy-0.0.0b17.dist-info/entry_points.txt +3 -0
- vtexpy-0.0.0b16.dist-info/RECORD +0 -29
- {vtexpy-0.0.0b16.dist-info → vtexpy-0.0.0b17.dist-info}/LICENSE +0 -0
- {vtexpy-0.0.0b16.dist-info → vtexpy-0.0.0b17.dist-info}/WHEEL +0 -0
vtex/_constants.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from logging import INFO, WARNING
|
|
2
|
+
|
|
1
3
|
# Vtex Auth
|
|
2
4
|
APP_KEY_HEADER = "X-VTEX-API-AppKey"
|
|
3
5
|
APP_TOKEN_HEADER = "X-VTEX-API-AppToken" # noqa: S105
|
|
@@ -12,15 +14,19 @@ RETRY_BACKOFF_MIN_ENV_VAR = "VTEX_RETRY_BACKOFF_MIN"
|
|
|
12
14
|
RETRY_BACKOFF_MAX_ENV_VAR = "VTEX_RETRY_BACKOFF_MAX"
|
|
13
15
|
RETRY_BACKOFF_EXPONENTIAL_ENV_VAR = "VTEX_RETRY_BACKOFF_EXPONENTIAL"
|
|
14
16
|
RETRY_STATUSES_ENV_VAR = "VTEX_RETRY_STATUSES"
|
|
15
|
-
RETRY_LOGS_ENV_VAR = "VTEX_RETRY_LOGS"
|
|
16
17
|
RAISE_FOR_STATUS_ENV_VAR = "VTEX_RAISE_FOR_STATUS"
|
|
18
|
+
LOG_RETRIES_ENV_VAR = "VTEX_LOG_RETRIES"
|
|
19
|
+
LOG_1XX_ENV_VAR = "VTEX_LOG_1XX"
|
|
20
|
+
LOG_2XX_ENV_VAR = "VTEX_LOG_2XX"
|
|
21
|
+
LOG_3XX_ENV_VAR = "VTEX_LOG_3XX"
|
|
22
|
+
LOG_4XX_ENV_VAR = "VTEX_LOG_4XX"
|
|
23
|
+
LOG_5XX_ENV_VAR = "VTEX_LOG_5XX"
|
|
17
24
|
|
|
18
|
-
DEFAULT_TIMEOUT =
|
|
25
|
+
DEFAULT_TIMEOUT = 60.0
|
|
19
26
|
DEFAULT_RETRY_ATTEMPTS = 5
|
|
20
27
|
DEFAULT_RETRY_BACKOFF_MIN = 1.0
|
|
21
28
|
DEFAULT_RETRY_BACKOFF_MAX = 64.0
|
|
22
|
-
|
|
23
|
-
DEFAULT_RETRY_STATUSES = {
|
|
29
|
+
DEFAULT_RETRY_STATUSES = [
|
|
24
30
|
401,
|
|
25
31
|
407,
|
|
26
32
|
408,
|
|
@@ -34,9 +40,15 @@ DEFAULT_RETRY_STATUSES = {
|
|
|
34
40
|
507,
|
|
35
41
|
511,
|
|
36
42
|
525,
|
|
37
|
-
|
|
38
|
-
DEFAULT_RETRY_LOGS = True
|
|
43
|
+
]
|
|
39
44
|
DEFAULT_RAISE_FOR_STATUS = True
|
|
45
|
+
DEFAULT_LOG_RETRIES = WARNING
|
|
46
|
+
DEFAULT_LOG_1XX = INFO
|
|
47
|
+
DEFAULT_LOG_2XX = INFO
|
|
48
|
+
DEFAULT_LOG_3XX = INFO
|
|
49
|
+
DEFAULT_LOG_4XX = WARNING
|
|
50
|
+
DEFAULT_LOG_5XX = WARNING
|
|
51
|
+
|
|
40
52
|
|
|
41
53
|
# Generics
|
|
42
54
|
MIN_PAGE_SIZE = 1
|
vtex/_dto.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
1
|
from json import JSONDecodeError
|
|
3
2
|
from math import ceil
|
|
4
3
|
from typing import Any, Dict, Generic, List, TypeVar, Union
|
|
5
4
|
|
|
6
5
|
from httpx import Request, Response
|
|
6
|
+
from pydantic import BaseModel, ConfigDict
|
|
7
7
|
|
|
8
8
|
from ._utils import remove_null_bytes, to_snake_case_deep
|
|
9
9
|
|
|
@@ -12,8 +12,9 @@ DataType = TypeVar("DataType", bound=Any)
|
|
|
12
12
|
ItemType = TypeVar("ItemType", bound=Any)
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
class VTEXRequest(BaseModel):
|
|
16
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
17
|
+
|
|
17
18
|
request: Request
|
|
18
19
|
method: str
|
|
19
20
|
url: str
|
|
@@ -29,8 +30,9 @@ class VTEXRequest:
|
|
|
29
30
|
)
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
class VTEXResponse(BaseModel):
|
|
34
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
35
|
+
|
|
34
36
|
request: VTEXRequest
|
|
35
37
|
response: Response
|
|
36
38
|
status: int
|
|
@@ -46,8 +48,9 @@ class VTEXResponse:
|
|
|
46
48
|
)
|
|
47
49
|
|
|
48
50
|
|
|
49
|
-
@dataclass
|
|
50
51
|
class VTEXDataResponse(VTEXResponse, Generic[DataType]):
|
|
52
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
53
|
+
|
|
51
54
|
data: DataType
|
|
52
55
|
|
|
53
56
|
@classmethod
|
|
@@ -70,8 +73,9 @@ class VTEXDataResponse(VTEXResponse, Generic[DataType]):
|
|
|
70
73
|
)
|
|
71
74
|
|
|
72
75
|
|
|
73
|
-
@dataclass
|
|
74
76
|
class VTEXItemsResponse(VTEXDataResponse[DataType], Generic[DataType, ItemType]):
|
|
77
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
78
|
+
|
|
75
79
|
items: List[ItemType]
|
|
76
80
|
|
|
77
81
|
@classmethod
|
|
@@ -100,8 +104,9 @@ class VTEXItemsResponse(VTEXDataResponse[DataType], Generic[DataType, ItemType])
|
|
|
100
104
|
)
|
|
101
105
|
|
|
102
106
|
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
class VTEXPagination(BaseModel):
|
|
108
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
109
|
+
|
|
105
110
|
total: int
|
|
106
111
|
pages: int
|
|
107
112
|
page_size: int
|
|
@@ -156,8 +161,9 @@ class VTEXPagination:
|
|
|
156
161
|
raise ValueError(f"Not a valid paginated items response: {vtex_items_response}")
|
|
157
162
|
|
|
158
163
|
|
|
159
|
-
@dataclass
|
|
160
164
|
class VTEXPaginatedItemsResponse(VTEXItemsResponse[DataType, ItemType]):
|
|
165
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
166
|
+
|
|
161
167
|
pagination: VTEXPagination
|
|
162
168
|
|
|
163
169
|
@classmethod
|
|
@@ -175,15 +181,14 @@ class VTEXPaginatedItemsResponse(VTEXItemsResponse[DataType, ItemType]):
|
|
|
175
181
|
)
|
|
176
182
|
|
|
177
183
|
|
|
178
|
-
|
|
179
|
-
class VTEXCartItem:
|
|
180
|
-
sku_id: str
|
|
181
|
-
quantity: int
|
|
184
|
+
class VTEXCartItem(BaseModel):
|
|
182
185
|
seller_id: str
|
|
186
|
+
sku_id: Union[int, str]
|
|
187
|
+
quantity: int
|
|
183
188
|
|
|
184
|
-
def to_vtex_cart_item(self) -> Dict[str,
|
|
189
|
+
def to_vtex_cart_item(self) -> Dict[str, Any]:
|
|
185
190
|
return {
|
|
186
|
-
"id": self.sku_id,
|
|
187
|
-
"quantity": self.quantity,
|
|
188
191
|
"seller": self.seller_id,
|
|
192
|
+
"id": str(self.sku_id),
|
|
193
|
+
"quantity": self.quantity,
|
|
189
194
|
}
|
vtex/_logging.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
1
|
+
from contextlib import contextmanager
|
|
2
|
+
from logging import CRITICAL, Logger, getLogger
|
|
3
|
+
from typing import Any, Callable, Generator, List, Union
|
|
3
4
|
|
|
4
5
|
from httpx import HTTPStatusError
|
|
5
6
|
from tenacity import RetryCallState
|
|
@@ -12,9 +13,27 @@ def get_logger(name: str, parent: Union[Logger, None] = None) -> Logger:
|
|
|
12
13
|
return getLogger(f"vtex.{name}")
|
|
13
14
|
|
|
14
15
|
|
|
16
|
+
@contextmanager
|
|
17
|
+
def disable_loggers(logger_names: List[str]) -> Generator[None, None, None]:
|
|
18
|
+
current_log_levels = {}
|
|
19
|
+
|
|
20
|
+
for logger_name in logger_names:
|
|
21
|
+
logger = getLogger(logger_name)
|
|
22
|
+
current_log_levels[logger_name] = logger.level
|
|
23
|
+
|
|
24
|
+
logger.setLevel(CRITICAL)
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
yield
|
|
28
|
+
finally:
|
|
29
|
+
for logger_name, log_level in current_log_levels.items():
|
|
30
|
+
getLogger(logger_name).setLevel(log_level)
|
|
31
|
+
|
|
32
|
+
|
|
15
33
|
def log_before_retry(
|
|
16
34
|
logger: Logger,
|
|
17
35
|
log_level: int,
|
|
36
|
+
**kwargs: Any,
|
|
18
37
|
) -> Callable[[RetryCallState], None]:
|
|
19
38
|
def retry_log(retry_state: RetryCallState) -> None:
|
|
20
39
|
if not retry_state.outcome or not retry_state.next_action:
|
|
@@ -32,12 +51,15 @@ def log_before_retry(
|
|
|
32
51
|
logger.log(
|
|
33
52
|
log_level,
|
|
34
53
|
f"Retrying {method} {url} in {retry_state.next_action.sleep}s as "
|
|
35
|
-
f"attempt {retry_state.attempt_number} failed with: {status}
|
|
54
|
+
f"attempt {retry_state.attempt_number} failed with: {status} {reason}",
|
|
36
55
|
extra={
|
|
37
56
|
"exception": exception,
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
57
|
+
"attempt": retry_state.attempt_number,
|
|
58
|
+
"sleep": retry_state.next_action.sleep,
|
|
59
|
+
"method": method,
|
|
60
|
+
"url": url,
|
|
61
|
+
"status": status,
|
|
62
|
+
**kwargs,
|
|
41
63
|
},
|
|
42
64
|
)
|
|
43
65
|
|
vtex/_types.py
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
from
|
|
1
|
+
from logging import CRITICAL, DEBUG, ERROR, INFO, WARNING
|
|
2
|
+
from sys import version_info
|
|
3
|
+
from typing import Literal
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
if version_info >= (3, 12):
|
|
6
|
+
from typing import TypedDict
|
|
7
|
+
else:
|
|
8
|
+
from typing_extensions import TypedDict
|
|
4
9
|
|
|
5
10
|
HTTPMethodType = Literal[
|
|
6
11
|
"DELETE",
|
|
@@ -19,4 +24,14 @@ HTTPMethodType = Literal[
|
|
|
19
24
|
"put",
|
|
20
25
|
]
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
LogLevelType = Literal[ # type: ignore[valid-type]
|
|
28
|
+
DEBUG,
|
|
29
|
+
INFO,
|
|
30
|
+
WARNING,
|
|
31
|
+
ERROR,
|
|
32
|
+
CRITICAL,
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
OrderingDirectionType = Literal["ASC", "DESC", "asc", "desc"]
|
|
36
|
+
|
|
37
|
+
TypedDict = TypedDict
|
vtex/_utils.py
CHANGED
|
@@ -15,22 +15,18 @@ TO_SNAKE_CASE_STEP_1_PATTERN = compile(r"(.)([A-Z][a-z]+)")
|
|
|
15
15
|
TO_SNAKE_CASE_STEP_2_PATTERN = compile(r"([a-z0-9])([A-Z])")
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
def
|
|
19
|
-
return value.
|
|
18
|
+
def omitting_undefined(obj: Dict[Any, Any]) -> Dict[Any, Any]:
|
|
19
|
+
return {key: value for key, value in obj.items() if value is not UNDEFINED}
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def
|
|
23
|
-
return
|
|
22
|
+
def remove_null_bytes(value: str) -> str:
|
|
23
|
+
return value.replace("\x00", "")
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def str_to_bool(value: str) -> bool:
|
|
27
27
|
return bool(strtobool(value))
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
def remove_null_bytes(value: str) -> str:
|
|
31
|
-
return value.replace("\x00", "")
|
|
32
|
-
|
|
33
|
-
|
|
34
30
|
def to_snake_case(string: str) -> str:
|
|
35
31
|
try:
|
|
36
32
|
UUID(string)
|
|
@@ -71,18 +67,6 @@ def to_snake_case_deep(obj: Any) -> Any:
|
|
|
71
67
|
return obj
|
|
72
68
|
|
|
73
69
|
|
|
74
|
-
def redact_headers(headers: Mapping[str, str]) -> Dict[str, str]:
|
|
75
|
-
redacted_headers = {}
|
|
76
|
-
|
|
77
|
-
for key, value in list(headers.items()):
|
|
78
|
-
if key.lower() in {APP_KEY_HEADER.lower(), APP_TOKEN_HEADER.lower()}:
|
|
79
|
-
redacted_headers[key] = "*" * 32
|
|
80
|
-
else:
|
|
81
|
-
redacted_headers[key] = value
|
|
82
|
-
|
|
83
|
-
return redacted_headers
|
|
84
|
-
|
|
85
|
-
|
|
86
70
|
def to_tzinfo(tz: Union[tzinfo, int, None] = None) -> tzinfo:
|
|
87
71
|
if isinstance(tz, tzinfo):
|
|
88
72
|
return tz
|
|
@@ -123,3 +107,15 @@ def three_years_ago(use_tz: bool = True, tz: Union[tzinfo, None] = None) -> date
|
|
|
123
107
|
second=0,
|
|
124
108
|
microsecond=0,
|
|
125
109
|
)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def redact_headers(headers: Mapping[str, str]) -> Dict[str, str]:
|
|
113
|
+
redacted_headers = {}
|
|
114
|
+
|
|
115
|
+
for key, value in list(headers.items()):
|
|
116
|
+
if key.lower() in {APP_KEY_HEADER.lower(), APP_TOKEN_HEADER.lower()}:
|
|
117
|
+
redacted_headers[key] = "*" * 32
|
|
118
|
+
else:
|
|
119
|
+
redacted_headers[key] = value
|
|
120
|
+
|
|
121
|
+
return redacted_headers
|
vtex/_vtex.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
from functools import cached_property
|
|
2
|
-
from typing import TYPE_CHECKING
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
3
|
|
|
4
|
-
from ._config import
|
|
4
|
+
from ._config import VTEXConfig
|
|
5
5
|
from ._logging import CLIENT_LOGGER
|
|
6
|
-
from ._sentinels import UNDEFINED, UndefinedSentinel
|
|
7
6
|
|
|
8
7
|
if TYPE_CHECKING:
|
|
9
8
|
from ._api import (
|
|
@@ -25,34 +24,9 @@ class VTEX:
|
|
|
25
24
|
From this class you can access all the APIs on VTEX
|
|
26
25
|
"""
|
|
27
26
|
|
|
28
|
-
def __init__(
|
|
29
|
-
self,
|
|
30
|
-
account_name: Union[str, UndefinedSentinel] = UNDEFINED,
|
|
31
|
-
app_key: Union[str, UndefinedSentinel] = UNDEFINED,
|
|
32
|
-
app_token: Union[str, UndefinedSentinel] = UNDEFINED,
|
|
33
|
-
timeout: Union[float, None, UndefinedSentinel] = UNDEFINED,
|
|
34
|
-
retry_attempts: Union[int, UndefinedSentinel] = UNDEFINED,
|
|
35
|
-
retry_backoff_min: Union[float, UndefinedSentinel] = UNDEFINED,
|
|
36
|
-
retry_backoff_max: Union[float, UndefinedSentinel] = UNDEFINED,
|
|
37
|
-
retry_backoff_exponential: Union[bool, float, UndefinedSentinel] = UNDEFINED,
|
|
38
|
-
retry_statuses: Union[List[int], UndefinedSentinel] = UNDEFINED,
|
|
39
|
-
retry_logs: Union[bool, UndefinedSentinel] = UNDEFINED,
|
|
40
|
-
raise_for_status: Union[bool, UndefinedSentinel] = UNDEFINED,
|
|
41
|
-
) -> None:
|
|
27
|
+
def __init__(self, config: VTEXConfig) -> None:
|
|
42
28
|
self.logger = CLIENT_LOGGER
|
|
43
|
-
self.config =
|
|
44
|
-
account_name=account_name,
|
|
45
|
-
app_key=app_key,
|
|
46
|
-
app_token=app_token,
|
|
47
|
-
timeout=timeout,
|
|
48
|
-
retry_attempts=retry_attempts,
|
|
49
|
-
retry_backoff_min=retry_backoff_min,
|
|
50
|
-
retry_backoff_max=retry_backoff_max,
|
|
51
|
-
retry_backoff_exponential=retry_backoff_exponential,
|
|
52
|
-
retry_statuses=retry_statuses,
|
|
53
|
-
retry_logs=retry_logs,
|
|
54
|
-
raise_for_status=raise_for_status,
|
|
55
|
-
)
|
|
29
|
+
self.config = config
|
|
56
30
|
|
|
57
31
|
@cached_property
|
|
58
32
|
def custom(self) -> "CustomAPI":
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: vtexpy
|
|
3
|
-
Version: 0.0.
|
|
4
|
-
Summary: Unofficial Python SDK
|
|
3
|
+
Version: 0.0.0b17
|
|
4
|
+
Summary: Unofficial VTEX API's Python SDK
|
|
5
5
|
Home-page: https://github.com/lvieirajr/vtex-python
|
|
6
|
-
License:
|
|
6
|
+
License: Apache
|
|
7
7
|
Keywords: vtex,sdk,client,api
|
|
8
8
|
Author: Luis Vieira
|
|
9
9
|
Author-email: lvieira@lvieira.com
|
|
10
10
|
Maintainer: Luis Vieira
|
|
11
11
|
Maintainer-email: lvieira@lvieira.com
|
|
12
|
-
Requires-Python: >=3.9,<3.
|
|
12
|
+
Requires-Python: >=3.9,<3.13
|
|
13
13
|
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
-
Classifier: License ::
|
|
16
|
+
Classifier: License :: Other/Proprietary License
|
|
17
17
|
Classifier: Operating System :: OS Independent
|
|
18
18
|
Classifier: Programming Language :: Python
|
|
19
19
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -21,13 +21,14 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
25
24
|
Classifier: Topic :: Software Development :: Libraries
|
|
26
25
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
26
|
Classifier: Typing :: Typed
|
|
28
27
|
Requires-Dist: httpx (>=0.26,<1.0)
|
|
28
|
+
Requires-Dist: pydantic (>=2.6,<3.0)
|
|
29
29
|
Requires-Dist: python-dateutil (>=2.9,<3.0)
|
|
30
30
|
Requires-Dist: tenacity (>=8.3,<10.0)
|
|
31
|
+
Requires-Dist: typing-extensions (>=4.7,<5.0) ; python_version < "3.12"
|
|
31
32
|
Project-URL: Documentation, https://github.com/lvieirajr/vtex-python
|
|
32
33
|
Project-URL: Repository, https://github.com/lvieirajr/vtex-python
|
|
33
34
|
Description-Content-Type: text/markdown
|
|
@@ -35,7 +36,7 @@ Description-Content-Type: text/markdown
|
|
|
35
36
|
# VTEXPY
|
|
36
37
|
[](https://pypi.python.org/pypi/vtexpy)
|
|
37
38
|
|
|
38
|
-
## Unofficial Python SDK
|
|
39
|
+
## Unofficial VTEX API's Python SDK
|
|
39
40
|
|
|
40
41
|
VTEXPY is an unofficial Python SDK designed to facilitate integration with the VTEX API.
|
|
41
42
|
|
|
@@ -45,19 +46,17 @@ API.
|
|
|
45
46
|
|
|
46
47
|
### Features
|
|
47
48
|
|
|
48
|
-
- Easy to use Python interface for calling
|
|
49
|
+
- Easy to use Python interface for calling VTEX API endpoints
|
|
50
|
+
- Response format standardization
|
|
49
51
|
- Custom exception handling
|
|
50
|
-
- Automatic
|
|
52
|
+
- Automatic request retrying
|
|
51
53
|
- Request logging
|
|
52
54
|
|
|
53
55
|
### Getting Started
|
|
54
56
|
|
|
55
57
|
#### Requirements
|
|
56
58
|
|
|
57
|
-
- Python >= 3.9, < 3.
|
|
58
|
-
- httpx >= 0.26, < 1.0
|
|
59
|
-
- python-dateutil >= 2.9, < 3.0
|
|
60
|
-
- tenacity >= 8.3, < 10.0
|
|
59
|
+
- Python >= 3.9, < 3.13
|
|
61
60
|
|
|
62
61
|
#### Installation
|
|
63
62
|
|
|
@@ -67,29 +66,34 @@ pip install vtexpy
|
|
|
67
66
|
|
|
68
67
|
#### Usage
|
|
69
68
|
|
|
70
|
-
If the API you want to call is not yet implemented, feel free to create an issue on the
|
|
69
|
+
If the API you want to call is not yet implemented, feel free to create an issue on the
|
|
71
70
|
VTEXPY Github repository and request it to be added.
|
|
72
71
|
|
|
73
72
|
```python
|
|
74
|
-
from vtex import VTEX
|
|
73
|
+
from vtex import VTEX, VTEXConfig
|
|
75
74
|
|
|
76
|
-
#
|
|
77
|
-
|
|
78
|
-
account_name="<ACCOUNT_NAME>",
|
|
79
|
-
app_key="<APP_KEY>",
|
|
75
|
+
# Instantiate your VTEX API configuration:
|
|
76
|
+
vtex_config = VTEXConfig(
|
|
77
|
+
account_name="<ACCOUNT_NAME>",
|
|
78
|
+
app_key="<APP_KEY>",
|
|
80
79
|
app_token="<APP_TOKEN>",
|
|
80
|
+
# Other arguments such as: retrying, logging, etc...
|
|
81
81
|
)
|
|
82
82
|
|
|
83
|
-
#
|
|
84
|
-
vtex_client
|
|
85
|
-
vtex_client.catalog.list_sku_ids(page=1, page_size=1000)
|
|
86
|
-
vtex_client.orders.list_orders(page=1, page_size=100)
|
|
83
|
+
# Instantiate the VTEX client with your configuration:
|
|
84
|
+
vtex_client = VTEX(config=vtex_config)
|
|
87
85
|
|
|
88
|
-
#
|
|
89
|
-
vtex_client.
|
|
86
|
+
# Call one of the available APIs, e.g.:
|
|
87
|
+
account_response = vtex_client.license_manager.get_account()
|
|
88
|
+
list_sku_ids_response = vtex_client.catalog.list_sku_ids(page=1, page_size=1000)
|
|
89
|
+
list_orders_response = vtex_client.orders.list_orders(page=1, page_size=100)
|
|
90
|
+
|
|
91
|
+
# If the API you want to call is not yet implemented you can use the `custom` API.
|
|
92
|
+
response = vtex_client.custom.request(
|
|
90
93
|
method="GET",
|
|
91
94
|
environment="vtexcommercestable",
|
|
92
95
|
endpoint="/api/catalog_system/pvt/commercialcondition/list",
|
|
96
|
+
# Other arguments such as: query params, headers, json data, response class, etc...
|
|
93
97
|
)
|
|
94
98
|
```
|
|
95
99
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
vtex/__init__.py,sha256=SLnqpZa19ISSQ9LDaCVLDAj-OxFlgVkQyEknydu20VU,636
|
|
2
|
+
vtex/_api/__init__.py,sha256=V4n0SQrqCcVFWtm8J7jbmwIRI9mCSURwdD_8uHGueAI,353
|
|
3
|
+
vtex/_api/base.py,sha256=e3_rADPPmA7gafPBhLEL7B8a7yJjScMvcXU4pke2gGM,6840
|
|
4
|
+
vtex/_api/catalog.py,sha256=0nYieUaEe2marzyDVpa23-XgtIXciK7n9rw8UqI9MU4,4661
|
|
5
|
+
vtex/_api/checkout.py,sha256=AMhSzyjAu5sZUpqevRorV706yXjNafqGDgbnq2wxVpg,1693
|
|
6
|
+
vtex/_api/custom.py,sha256=9_Rk5sBYtsOU7-OxrrU8FnK1o_0gr5SdRu7uFjm-wtQ,3016
|
|
7
|
+
vtex/_api/license_manager.py,sha256=DRHCOBmDTY6E4pSjcfZckTJD87bip_SXgu85qCNwwE0,2691
|
|
8
|
+
vtex/_api/logistics.py,sha256=oJECrgctqp4uzB7vK8NpcJ44TBlabvXP8hxA5dES9jE,4488
|
|
9
|
+
vtex/_api/master_data.py,sha256=JdMA_dWpbSY7TAJY5MobmQ7OsnoofJA60Qbx8IA6pe0,2046
|
|
10
|
+
vtex/_api/orders.py,sha256=CFfZ6zd2Uf8kj8MXziZJ0EqypzaqbiZdrAu1NhV79yY,5064
|
|
11
|
+
vtex/_api/payments_gateway.py,sha256=5XkxbXGI7OEQEaykL-y-3PKnfloy380fjUQ18Ctts9E,3804
|
|
12
|
+
vtex/_api/promotions_and_taxes.py,sha256=yi9EDlOTop77_DqUF-E9SjblfgF4FyXyerA0_QZplJ4,1893
|
|
13
|
+
vtex/_api/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
vtex/_api/types/catalog.py,sha256=O_qLoiGMyBxRdmxPclbbPobUxJSzViqzHiKf8tgfm_I,394
|
|
15
|
+
vtex/_api/types/generic.py,sha256=m1lFTPeyBNi-K0shvK4uxE5SUyvhTTX_5Ls2VockkdI,344
|
|
16
|
+
vtex/_api/types/license_manager.py,sha256=KYISnKdQ548g6x5cNieoaN6gh9C1LQVFv4sH-II1maI,1015
|
|
17
|
+
vtex/_config.py,sha256=Uu2yaXlNh1zXjHkkEYnieCSWBsYr2DrIVH-K90mrbgY,11607
|
|
18
|
+
vtex/_constants.py,sha256=YKuXRyKuGIZeJFc2k5tCKS2Y4DlMLSnEg17kv01qV_A,2069
|
|
19
|
+
vtex/_dto.py,sha256=dq-MuKdIOJsrKDlHNBPnx337KusCM2LsO7HIvikCN0Y,6439
|
|
20
|
+
vtex/_exceptions.py,sha256=yglSMmPy4oYWU65oGY1XWA1CbmW1MJO8K-bGYIjoXeg,2127
|
|
21
|
+
vtex/_logging.py,sha256=C1h6Ta1EoXNPdP4U64-3iRCE0Qu-u6XLzSbyBKxkEFg,2226
|
|
22
|
+
vtex/_sentinels.py,sha256=HLkYBJVHTx9GoyACPO1SuINaGlU2YiqOPuFXUa7iG8A,1120
|
|
23
|
+
vtex/_types.py,sha256=xrqHzmrc0IhE5fc1aGf0StCm3BQbVFyk3LG4Hd7Wd2Q,631
|
|
24
|
+
vtex/_utils.py,sha256=jeaC1dU_bTtz8w5Qep2hV-wqqbA-cxDhXf_7GJcv_S8,3379
|
|
25
|
+
vtex/_vtex.py,sha256=Vt-ERteT70vpXHpe2Q4VlkR5qpz_AS_Ni2OsS0hgDZs,2003
|
|
26
|
+
vtex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
+
vtexpy-0.0.0b17.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
28
|
+
vtexpy-0.0.0b17.dist-info/METADATA,sha256=peba2lg36WiKgz0k9_v5A3R4_4xYjVwN34fsMa_C7iQ,3262
|
|
29
|
+
vtexpy-0.0.0b17.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
30
|
+
vtexpy-0.0.0b17.dist-info/entry_points.txt,sha256=9UWXc3qqZIKLEbFaQjiOEd8GyesacU7uc3O7xdvPp7U,56
|
|
31
|
+
vtexpy-0.0.0b17.dist-info/RECORD,,
|
vtexpy-0.0.0b16.dist-info/RECORD
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
vtex/__init__.py,sha256=OwOtOH0pFnXplGHndMz7gOM6WE12etFD6orzxLNlkA8,586
|
|
2
|
-
vtex/_api/__init__.py,sha256=V4n0SQrqCcVFWtm8J7jbmwIRI9mCSURwdD_8uHGueAI,353
|
|
3
|
-
vtex/_api/base.py,sha256=rux3pUNhz76B4dm6I1I9ojnuWKp8oR2EhnJ12anxnCU,5564
|
|
4
|
-
vtex/_api/catalog.py,sha256=fEKAHeHk_bOWG1qTLHvfHnCH_M9jYsSUzhbaAIKumqg,4290
|
|
5
|
-
vtex/_api/checkout.py,sha256=Q_PxFvWyWNzRJw-YJuHi2NSjRqQfQ-R2NIlYhXl3Dh0,1751
|
|
6
|
-
vtex/_api/custom.py,sha256=QzxN1bst3Rnd4guy1e-9c8SmE7ILFu0fUpmAG7Ki0Dg,2699
|
|
7
|
-
vtex/_api/license_manager.py,sha256=9X6sdkIUwry-gDNtO5-5q9HNqxXw4q-nPs_IGbG4CkE,2678
|
|
8
|
-
vtex/_api/logistics.py,sha256=tXg9V2wIBqNJuUUTJEZx4esN9T66ZKVxPb7X_4hPbUU,4618
|
|
9
|
-
vtex/_api/master_data.py,sha256=1q_OKY5Cf2Cfe1lcGI2hOplXZb-VSLFIO3jXReVHMVI,2088
|
|
10
|
-
vtex/_api/orders.py,sha256=Im-82XoFd1CI-nAQm-ByeS68Mg6mvfw7nhh_WS63SWU,5134
|
|
11
|
-
vtex/_api/payments_gateway.py,sha256=d6Lr3D7Aj6HXXP2gX8TA961C75JQ1lelTmdb2Sjo5Os,3934
|
|
12
|
-
vtex/_api/promotions_and_taxes.py,sha256=S8Vp0tlZAyJITAXEnxPi8LZMjE4wl_aChDRV1YAqt34,1973
|
|
13
|
-
vtex/_api/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
vtex/_api/types/generic.py,sha256=ek7LyfYLpc3KFCJFy8A-yukTNZhhvvjaikOOHZSL6EE,377
|
|
15
|
-
vtex/_api/types/license_manager.py,sha256=U0PPQSVBX1UGTU_of6dsHJyYgAh1WI1yIR45bbE8170,997
|
|
16
|
-
vtex/_config.py,sha256=RmsQG_hILqEU5HHnnuLh--LxFhn8uSfrk-yPE-_WJhE,16836
|
|
17
|
-
vtex/_constants.py,sha256=pBUOzw33JsKKdlDEXYTH_yuoLlnm1fJYDUayzCGc3qI,1779
|
|
18
|
-
vtex/_dto.py,sha256=gX_r0685dXRo916A-ZSw9vYfN7XcxFLxkaiIBRbxA6M,6092
|
|
19
|
-
vtex/_exceptions.py,sha256=yglSMmPy4oYWU65oGY1XWA1CbmW1MJO8K-bGYIjoXeg,2127
|
|
20
|
-
vtex/_logging.py,sha256=66tjBs0KvbU3dB14PdSjhdi0C4RT60GEuMPvOe87j7s,1622
|
|
21
|
-
vtex/_sentinels.py,sha256=HLkYBJVHTx9GoyACPO1SuINaGlU2YiqOPuFXUa7iG8A,1120
|
|
22
|
-
vtex/_types.py,sha256=I_vca-7hqRiMXJOXMB40OVTlypXdujduf4LSwW-tGKk,333
|
|
23
|
-
vtex/_utils.py,sha256=OdKGAyGks0sYo8z9ljVVUnWyPZttEluE4hWCrK0hcJA,3483
|
|
24
|
-
vtex/_vtex.py,sha256=kz3SfwSW8rcRVSW_-5MXb8njpqWNknzA8JDYZu9-Vjo,3321
|
|
25
|
-
vtex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
vtexpy-0.0.0b16.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
27
|
-
vtexpy-0.0.0b16.dist-info/METADATA,sha256=gQ66qZDf3pWhN53rBz-zMhXFS5nXqNd7xUBe-egOyLQ,2956
|
|
28
|
-
vtexpy-0.0.0b16.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
29
|
-
vtexpy-0.0.0b16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|