vtexpy 0.0.0b18__py3-none-any.whl → 0.0.0b19__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/_api/custom.py +1 -1
- vtex/_api/orders.py +5 -3
- vtex/_utils.py +13 -7
- {vtexpy-0.0.0b18.dist-info → vtexpy-0.0.0b19.dist-info}/METADATA +1 -1
- {vtexpy-0.0.0b18.dist-info → vtexpy-0.0.0b19.dist-info}/RECORD +7 -7
- {vtexpy-0.0.0b18.dist-info → vtexpy-0.0.0b19.dist-info}/LICENSE +0 -0
- {vtexpy-0.0.0b18.dist-info → vtexpy-0.0.0b19.dist-info}/WHEEL +0 -0
vtex/_api/custom.py
CHANGED
|
@@ -61,7 +61,7 @@ class CustomAPI(BaseAPI):
|
|
|
61
61
|
def get_creation_date(self) -> datetime:
|
|
62
62
|
return to_datetime(
|
|
63
63
|
self.client.license_manager.get_account().data["creation_date"],
|
|
64
|
-
)
|
|
64
|
+
).replace(hour=0, minute=0, second=0, microsecond=0)
|
|
65
65
|
|
|
66
66
|
def list_sites(self) -> List[AccountSite]:
|
|
67
67
|
return self.client.license_manager.get_account().data["sites"]
|
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,
|
|
14
|
+
from .._utils import now, years_ago
|
|
15
15
|
from .base import BaseAPI
|
|
16
16
|
|
|
17
17
|
|
|
@@ -60,18 +60,20 @@ 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 =
|
|
63
|
+
creation_date_from = years_ago(years=4)
|
|
64
64
|
|
|
65
65
|
if not isinstance(creation_date_to, datetime):
|
|
66
|
-
creation_date_to = now() + timedelta(
|
|
66
|
+
creation_date_to = now() + timedelta(minutes=1)
|
|
67
67
|
|
|
68
68
|
start = (
|
|
69
69
|
creation_date_from.astimezone(timezone.utc)
|
|
70
|
+
.replace(microsecond=0)
|
|
70
71
|
.isoformat(timespec="milliseconds")
|
|
71
72
|
.split("+")[0]
|
|
72
73
|
)
|
|
73
74
|
end = (
|
|
74
75
|
creation_date_to.astimezone(timezone.utc)
|
|
76
|
+
.replace(microsecond=999999)
|
|
75
77
|
.isoformat(timespec="milliseconds")
|
|
76
78
|
.split("+")[0]
|
|
77
79
|
)
|
vtex/_utils.py
CHANGED
|
@@ -15,6 +15,10 @@ 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 str_to_bool(value: str) -> bool:
|
|
19
|
+
return bool(strtobool(value))
|
|
20
|
+
|
|
21
|
+
|
|
18
22
|
def omitting_undefined(obj: Dict[Any, Any]) -> Dict[Any, Any]:
|
|
19
23
|
return {key: value for key, value in obj.items() if value is not UNDEFINED}
|
|
20
24
|
|
|
@@ -23,11 +27,9 @@ def remove_null_bytes(value: str) -> str:
|
|
|
23
27
|
return value.replace("\x00", "")
|
|
24
28
|
|
|
25
29
|
|
|
26
|
-
def str_to_bool(value: str) -> bool:
|
|
27
|
-
return bool(strtobool(value))
|
|
28
|
-
|
|
29
|
-
|
|
30
30
|
def to_snake_case(string: str) -> str:
|
|
31
|
+
string = remove_null_bytes(string)
|
|
32
|
+
|
|
31
33
|
try:
|
|
32
34
|
UUID(string)
|
|
33
35
|
except (AttributeError, ValueError, TypeError):
|
|
@@ -45,7 +47,7 @@ def to_snake_case_deep(obj: Any) -> Any:
|
|
|
45
47
|
|
|
46
48
|
for key, value in sorted(obj.items(), key=lambda item: item[0]):
|
|
47
49
|
if isinstance(key, str):
|
|
48
|
-
key = to_snake_case(
|
|
50
|
+
key = to_snake_case(key)
|
|
49
51
|
|
|
50
52
|
while key in snake_cased_obj:
|
|
51
53
|
UTILS_LOGGER.debug(
|
|
@@ -97,11 +99,15 @@ def now(use_tz: bool = True, tz: Union[tzinfo, None] = None) -> datetime:
|
|
|
97
99
|
return datetime.now(to_tzinfo(tz) if use_tz else None)
|
|
98
100
|
|
|
99
101
|
|
|
100
|
-
def
|
|
102
|
+
def years_ago(
|
|
103
|
+
years: int,
|
|
104
|
+
use_tz: bool = True,
|
|
105
|
+
tz: Union[tzinfo, None] = None,
|
|
106
|
+
) -> datetime:
|
|
101
107
|
current_datetime = now(use_tz=use_tz, tz=tz)
|
|
102
108
|
|
|
103
109
|
return current_datetime.replace(
|
|
104
|
-
year=current_datetime.year -
|
|
110
|
+
year=current_datetime.year - years,
|
|
105
111
|
hour=0,
|
|
106
112
|
minute=0,
|
|
107
113
|
second=0,
|
|
@@ -3,11 +3,11 @@ vtex/_api/__init__.py,sha256=V4n0SQrqCcVFWtm8J7jbmwIRI9mCSURwdD_8uHGueAI,353
|
|
|
3
3
|
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
|
-
vtex/_api/custom.py,sha256=
|
|
6
|
+
vtex/_api/custom.py,sha256=0zSbV0CX4Fr-u3GdwCSRNOj7cz_zai36FnbK8KAxtT0,3067
|
|
7
7
|
vtex/_api/license_manager.py,sha256=DRHCOBmDTY6E4pSjcfZckTJD87bip_SXgu85qCNwwE0,2691
|
|
8
8
|
vtex/_api/logistics.py,sha256=oJECrgctqp4uzB7vK8NpcJ44TBlabvXP8hxA5dES9jE,4488
|
|
9
9
|
vtex/_api/master_data.py,sha256=JdMA_dWpbSY7TAJY5MobmQ7OsnoofJA60Qbx8IA6pe0,2046
|
|
10
|
-
vtex/_api/orders.py,sha256=
|
|
10
|
+
vtex/_api/orders.py,sha256=w15rKdArlCoI7PXSbuoIaj1v9hGIxBUVgM_9JHq8wEo,5127
|
|
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
|
|
@@ -21,10 +21,10 @@ 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=
|
|
24
|
+
vtex/_utils.py,sha256=avSFE3v-HaUrof6JBzyspqA-eDrfOF5hnJT-KlRB0_8,3425
|
|
25
25
|
vtex/_vtex.py,sha256=Vt-ERteT70vpXHpe2Q4VlkR5qpz_AS_Ni2OsS0hgDZs,2003
|
|
26
26
|
vtex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
-
vtexpy-0.0.
|
|
28
|
-
vtexpy-0.0.
|
|
29
|
-
vtexpy-0.0.
|
|
30
|
-
vtexpy-0.0.
|
|
27
|
+
vtexpy-0.0.0b19.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
28
|
+
vtexpy-0.0.0b19.dist-info/METADATA,sha256=ZA75wlDBXVYHa5NMkEQ6IbTpbZT-KiwtLBdk-rsB-xg,3402
|
|
29
|
+
vtexpy-0.0.0b19.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
30
|
+
vtexpy-0.0.0b19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|