vtexpy 0.0.0b33__tar.gz → 0.0.0b34__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.
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/PKG-INFO +1 -1
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/pyproject.toml +1 -1
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/base.py +19 -11
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/LICENSE +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/README.md +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/__init__.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/__init__.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/catalog.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/checkout.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/custom.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/license_manager.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/logistics.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/master_data.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/orders.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/payments_gateway.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/pricing.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/promotions_and_taxes.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/types/__init__.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/types/catalog.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/types/generic.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_api/types/license_manager.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_config.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_constants.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_dto.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_exceptions.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_logging.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_sentinels.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_types.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_utils.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/_vtex.py +0 -0
- {vtexpy-0.0.0b33 → vtexpy-0.0.0b34}/vtex/py.typed +0 -0
|
@@ -18,7 +18,7 @@ from httpx._types import (
|
|
|
18
18
|
RequestData,
|
|
19
19
|
RequestFiles,
|
|
20
20
|
)
|
|
21
|
-
from limits import RateLimitItem, storage, strategies
|
|
21
|
+
from limits import RateLimitItem, errors, storage, strategies
|
|
22
22
|
from tenacity import (
|
|
23
23
|
retry,
|
|
24
24
|
retry_if_exception_type,
|
|
@@ -48,7 +48,7 @@ class BaseAPI:
|
|
|
48
48
|
parent=self.client.logger,
|
|
49
49
|
)
|
|
50
50
|
|
|
51
|
-
def _request(
|
|
51
|
+
def _request( # noqa: C901
|
|
52
52
|
self,
|
|
53
53
|
method: HTTPMethodType,
|
|
54
54
|
endpoint: str,
|
|
@@ -92,7 +92,10 @@ class BaseAPI:
|
|
|
92
92
|
rate_limit and rate_limit_key and request_config.rate_limit_storage_url
|
|
93
93
|
)
|
|
94
94
|
else strategies.MovingWindowRateLimiter(
|
|
95
|
-
storage.storage_from_string(
|
|
95
|
+
storage.storage_from_string(
|
|
96
|
+
request_config.rate_limit_storage_url,
|
|
97
|
+
wrap_exceptions=True,
|
|
98
|
+
),
|
|
96
99
|
)
|
|
97
100
|
)
|
|
98
101
|
|
|
@@ -122,13 +125,15 @@ class BaseAPI:
|
|
|
122
125
|
def send_vtex_request() -> Response:
|
|
123
126
|
with Client(timeout=request_config.timeout) as client:
|
|
124
127
|
with disable_loggers(["httpcore", "httpx"]):
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
if rate_limit and rate_limit_key and rate_limiter:
|
|
129
|
+
while True:
|
|
130
|
+
try:
|
|
131
|
+
if rate_limiter.test(rate_limit, rate_limit_key):
|
|
132
|
+
break
|
|
133
|
+
except errors.StorageError:
|
|
134
|
+
pass
|
|
135
|
+
|
|
136
|
+
sleep(1)
|
|
132
137
|
|
|
133
138
|
try:
|
|
134
139
|
response = client.request(
|
|
@@ -144,7 +149,10 @@ class BaseAPI:
|
|
|
144
149
|
)
|
|
145
150
|
finally:
|
|
146
151
|
if rate_limit and rate_limit_key and rate_limiter:
|
|
147
|
-
|
|
152
|
+
try:
|
|
153
|
+
rate_limiter.hit(rate_limit, rate_limit_key)
|
|
154
|
+
except errors.StorageError:
|
|
155
|
+
pass
|
|
148
156
|
|
|
149
157
|
response.request.headers = Headers(
|
|
150
158
|
redact_headers(dict(response.request.headers)),
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|