vtexpy 0.0.0b24__tar.gz → 0.0.0b26__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.0b24 → vtexpy-0.0.0b26}/PKG-INFO +1 -1
  2. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/pyproject.toml +1 -1
  3. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/base.py +4 -4
  4. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_config.py +18 -18
  5. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_constants.py +4 -4
  6. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_dto.py +5 -5
  7. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_exceptions.py +3 -3
  8. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_logging.py +3 -3
  9. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/LICENSE +0 -0
  10. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/README.md +0 -0
  11. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/__init__.py +0 -0
  12. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/__init__.py +0 -0
  13. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/catalog.py +0 -0
  14. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/checkout.py +0 -0
  15. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/custom.py +0 -0
  16. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/license_manager.py +0 -0
  17. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/logistics.py +0 -0
  18. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/master_data.py +0 -0
  19. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/orders.py +0 -0
  20. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/payments_gateway.py +0 -0
  21. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/promotions_and_taxes.py +0 -0
  22. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/types/__init__.py +0 -0
  23. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/types/catalog.py +0 -0
  24. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/types/generic.py +0 -0
  25. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_api/types/license_manager.py +0 -0
  26. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_sentinels.py +0 -0
  27. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_types.py +0 -0
  28. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_utils.py +0 -0
  29. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/_vtex.py +0 -0
  30. {vtexpy-0.0.0b24 → vtexpy-0.0.0b26}/vtex/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vtexpy
3
- Version: 0.0.0b24
3
+ Version: 0.0.0b26
4
4
  Summary: Unofficial VTEX API's Python SDK
5
5
  Home-page: https://github.com/lvieirajr/vtex-python
6
6
  License: Apache
@@ -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.0b24"
8
+ version = "0.0.0b26"
9
9
  readme = "README.md"
10
10
  license = "Apache"
11
11
  authors = [
@@ -134,14 +134,14 @@ class BaseAPI:
134
134
  extra={
135
135
  "method": response.request.method,
136
136
  "url": response.request.url,
137
- "status": response.status_code,
137
+ "status_code": response.status_code,
138
138
  "environment": environment,
139
139
  "endpoint": endpoint,
140
140
  "account_name": request_config.account_name,
141
141
  },
142
142
  )
143
143
 
144
- if response.status_code in request_config.retry_statuses:
144
+ if response.status_code in request_config.retry_status_codes:
145
145
  response.raise_for_status()
146
146
 
147
147
  return response
@@ -172,7 +172,7 @@ class BaseAPI:
172
172
  )
173
173
 
174
174
  def _raise_from_response(self, response: Response, config: VTEXConfig) -> None:
175
- if response.is_error and config.raise_for_status:
175
+ if response.is_error and config.raise_for_status_code:
176
176
  try:
177
177
  data = to_snake_case_deep(response.json(strict=False))
178
178
  except JSONDecodeError:
@@ -183,7 +183,7 @@ class BaseAPI:
183
183
  method=str(response.request.method).upper(),
184
184
  url=str(response.request.url),
185
185
  request_headers=response.request.headers,
186
- status=response.status_code,
186
+ status_code=response.status_code,
187
187
  data=data,
188
188
  response_headers=response.headers,
189
189
  ) from None
@@ -14,11 +14,11 @@ from ._constants import (
14
14
  DEFAULT_LOG_4XX,
15
15
  DEFAULT_LOG_5XX,
16
16
  DEFAULT_LOG_RETRIES,
17
- DEFAULT_RAISE_FOR_STATUS,
17
+ DEFAULT_RAISE_FOR_STATUS_CODE,
18
18
  DEFAULT_RETRY_ATTEMPTS,
19
19
  DEFAULT_RETRY_BACKOFF_MAX,
20
20
  DEFAULT_RETRY_BACKOFF_MIN,
21
- DEFAULT_RETRY_STATUSES,
21
+ DEFAULT_RETRY_STATUS_CODES,
22
22
  DEFAULT_TIMEOUT,
23
23
  LOG_1XX_ENV_VAR,
24
24
  LOG_2XX_ENV_VAR,
@@ -26,11 +26,11 @@ from ._constants import (
26
26
  LOG_4XX_ENV_VAR,
27
27
  LOG_5XX_ENV_VAR,
28
28
  LOG_RETRIES_ENV_VAR,
29
- RAISE_FOR_STATUS_ENV_VAR,
29
+ RAISE_FOR_STATUS_CODE_ENV_VAR,
30
30
  RETRY_ATTEMPTS_ENV_VAR,
31
31
  RETRY_BACKOFF_MAX_ENV_VAR,
32
32
  RETRY_BACKOFF_MIN_ENV_VAR,
33
- RETRY_STATUSES_ENV_VAR,
33
+ RETRY_STATUS_CODES_ENV_VAR,
34
34
  TIMEOUT_ENV_VAR,
35
35
  )
36
36
  from ._sentinels import UNDEFINED, UndefinedSentinel
@@ -51,9 +51,9 @@ class VTEXConfig(BaseModel):
51
51
  retry_attempts: int = Field(UNDEFINED, validate_default=True)
52
52
  retry_backoff_min: float = Field(UNDEFINED, validate_default=True)
53
53
  retry_backoff_max: float = Field(UNDEFINED, validate_default=True)
54
- retry_statuses: List[int] = Field(UNDEFINED, validate_default=True)
54
+ retry_status_codes: List[int] = Field(UNDEFINED, validate_default=True)
55
55
 
56
- raise_for_status: bool = Field(UNDEFINED, validate_default=True)
56
+ raise_for_status_code: bool = Field(UNDEFINED, validate_default=True)
57
57
 
58
58
  log_retries: FalseOrLogLevel = Field(UNDEFINED, validate_default=True)
59
59
  log_1xx: FalseOrLogLevel = Field(UNDEFINED, validate_default=True)
@@ -71,8 +71,8 @@ class VTEXConfig(BaseModel):
71
71
  retry_attempts: Union[int, UndefinedSentinel] = UNDEFINED,
72
72
  retry_backoff_min: Union[float, int, UndefinedSentinel] = UNDEFINED,
73
73
  retry_backoff_max: Union[float, int, UndefinedSentinel] = UNDEFINED,
74
- retry_statuses: Union[List[int], UndefinedSentinel] = UNDEFINED,
75
- raise_for_status: Union[bool, UndefinedSentinel] = UNDEFINED,
74
+ retry_status_codes: Union[List[int], UndefinedSentinel] = UNDEFINED,
75
+ raise_for_status_code: Union[bool, UndefinedSentinel] = UNDEFINED,
76
76
  log_retries: FalseOrLogLevelOrUndefined = UNDEFINED,
77
77
  log_1xx: FalseOrLogLevelOrUndefined = UNDEFINED,
78
78
  log_2xx: FalseOrLogLevelOrUndefined = UNDEFINED,
@@ -91,8 +91,8 @@ class VTEXConfig(BaseModel):
91
91
  "retry_attempts": retry_attempts,
92
92
  "retry_backoff_min": retry_backoff_min,
93
93
  "retry_backoff_max": retry_backoff_max,
94
- "retry_statuses": retry_statuses,
95
- "raise_for_status": raise_for_status,
94
+ "retry_status_codes": retry_status_codes,
95
+ "raise_for_status_code": raise_for_status_code,
96
96
  "log_retries": log_retries,
97
97
  "log_1xx": log_1xx,
98
98
  "log_2xx": log_2xx,
@@ -175,11 +175,11 @@ class VTEXConfig(BaseModel):
175
175
  allow_zero=False,
176
176
  )
177
177
 
178
- @field_validator("retry_statuses", mode="before")
178
+ @field_validator("retry_status_codes", mode="before")
179
179
  @classmethod
180
- def validate_retry_statuses(cls, value: Any) -> List[int]:
180
+ def validate_retry_status_codes(cls, value: Any) -> List[int]:
181
181
  if isinstance(value, UndefinedSentinel):
182
- value = getenv(RETRY_STATUSES_ENV_VAR, DEFAULT_RETRY_STATUSES)
182
+ value = getenv(RETRY_STATUS_CODES_ENV_VAR, DEFAULT_RETRY_STATUS_CODES)
183
183
 
184
184
  if isinstance(value, str):
185
185
  if value == "":
@@ -199,13 +199,13 @@ class VTEXConfig(BaseModel):
199
199
  ):
200
200
  return list(value)
201
201
 
202
- raise cls._prepare_value_error(value, RETRY_STATUSES_ENV_VAR)
202
+ raise cls._prepare_value_error(value, RETRY_STATUS_CODES_ENV_VAR)
203
203
 
204
- @field_validator("raise_for_status", mode="before")
204
+ @field_validator("raise_for_status_code", mode="before")
205
205
  @classmethod
206
- def validate_raise_for_status(cls, value: Any) -> bool:
206
+ def validate_raise_for_status_code(cls, value: Any) -> bool:
207
207
  if isinstance(value, UndefinedSentinel):
208
- value = getenv(RAISE_FOR_STATUS_ENV_VAR, DEFAULT_RAISE_FOR_STATUS)
208
+ value = getenv(RAISE_FOR_STATUS_CODE_ENV_VAR, DEFAULT_RAISE_FOR_STATUS_CODE)
209
209
 
210
210
  if isinstance(value, str):
211
211
  try:
@@ -216,7 +216,7 @@ class VTEXConfig(BaseModel):
216
216
  if isinstance(value, bool):
217
217
  return value
218
218
 
219
- raise cls._prepare_value_error(value, RAISE_FOR_STATUS_ENV_VAR)
219
+ raise cls._prepare_value_error(value, RAISE_FOR_STATUS_CODE_ENV_VAR)
220
220
 
221
221
  @field_validator("log_retries", mode="before")
222
222
  @classmethod
@@ -18,8 +18,8 @@ TIMEOUT_ENV_VAR = "VTEX_TIMEOUT"
18
18
  RETRY_ATTEMPTS_ENV_VAR = "VTEX_RETRY_ATTEMPTS"
19
19
  RETRY_BACKOFF_MIN_ENV_VAR = "VTEX_RETRY_BACKOFF_MIN"
20
20
  RETRY_BACKOFF_MAX_ENV_VAR = "VTEX_RETRY_BACKOFF_MAX"
21
- RETRY_STATUSES_ENV_VAR = "VTEX_RETRY_STATUSES"
22
- RAISE_FOR_STATUS_ENV_VAR = "VTEX_RAISE_FOR_STATUS"
21
+ RETRY_STATUS_CODES_ENV_VAR = "VTEX_RETRY_STATUS_CODES"
22
+ RAISE_FOR_STATUS_CODE_ENV_VAR = "VTEX_RAISE_FOR_STATUS_CODE"
23
23
  LOG_RETRIES_ENV_VAR = "VTEX_LOG_RETRIES"
24
24
  LOG_1XX_ENV_VAR = "VTEX_LOG_1XX"
25
25
  LOG_2XX_ENV_VAR = "VTEX_LOG_2XX"
@@ -31,7 +31,7 @@ DEFAULT_TIMEOUT = MINUTE
31
31
  DEFAULT_RETRY_ATTEMPTS = 10
32
32
  DEFAULT_RETRY_BACKOFF_MIN = SECOND
33
33
  DEFAULT_RETRY_BACKOFF_MAX = MINUTE
34
- DEFAULT_RETRY_STATUSES = [
34
+ DEFAULT_RETRY_STATUS_CODES = [
35
35
  407,
36
36
  408,
37
37
  409,
@@ -45,7 +45,7 @@ DEFAULT_RETRY_STATUSES = [
45
45
  511,
46
46
  525,
47
47
  ]
48
- DEFAULT_RAISE_FOR_STATUS = True
48
+ DEFAULT_RAISE_FOR_STATUS_CODE = True
49
49
  DEFAULT_LOG_RETRIES = WARNING
50
50
  DEFAULT_LOG_1XX = INFO
51
51
  DEFAULT_LOG_2XX = INFO
@@ -35,7 +35,7 @@ class VTEXResponse(BaseModel):
35
35
 
36
36
  request: VTEXRequest
37
37
  response: Response
38
- status: int
38
+ status_code: int
39
39
  headers: Dict[str, str]
40
40
 
41
41
  @classmethod
@@ -43,7 +43,7 @@ class VTEXResponse(BaseModel):
43
43
  return cls(
44
44
  request=VTEXRequest.factory(response.request),
45
45
  response=response,
46
- status=int(response.status_code),
46
+ status_code=int(response.status_code),
47
47
  headers=dict(response.headers),
48
48
  )
49
49
 
@@ -67,7 +67,7 @@ class VTEXDataResponse(VTEXResponse, Generic[DataType]):
67
67
  return cls(
68
68
  request=vtex_response.request,
69
69
  response=vtex_response.response,
70
- status=vtex_response.status,
70
+ status_code=vtex_response.status_code,
71
71
  headers=vtex_response.headers,
72
72
  data=cls.get_original_response_data(response),
73
73
  )
@@ -97,7 +97,7 @@ class VTEXItemsResponse(VTEXDataResponse[DataType], Generic[DataType, ItemType])
97
97
  return cls(
98
98
  request=vtex_data_response.request,
99
99
  response=vtex_data_response.response,
100
- status=vtex_data_response.status,
100
+ status_code=vtex_data_response.status_code,
101
101
  headers=vtex_data_response.headers,
102
102
  data=vtex_data_response.data,
103
103
  items=list(items),
@@ -174,7 +174,7 @@ class VTEXPaginatedItemsResponse(VTEXItemsResponse[DataType, ItemType]):
174
174
  request=vtex_items_response.request,
175
175
  response=vtex_items_response.response,
176
176
  data=vtex_items_response.data,
177
- status=vtex_items_response.status,
177
+ status_code=vtex_items_response.status_code,
178
178
  headers=vtex_items_response.headers,
179
179
  items=vtex_items_response.items,
180
180
  pagination=VTEXPagination.factory(vtex_items_response),
@@ -43,7 +43,7 @@ class VTEXResponseError(VTEXError):
43
43
  method: Union[str, None] = None,
44
44
  url: Union[str, None] = None,
45
45
  request_headers: Union[Headers, Dict[str, str], None] = None,
46
- status: Union[int, None] = None,
46
+ status_code: Union[int, None] = None,
47
47
  data: Any = None,
48
48
  response_headers: Union[Headers, Dict[str, str], None] = None,
49
49
  **kwargs: Any,
@@ -52,7 +52,7 @@ class VTEXResponseError(VTEXError):
52
52
  self.method = method
53
53
  self.url = url
54
54
  self.request_headers = dict(request_headers) if request_headers else None
55
- self.status = status
55
+ self.status_code = status_code
56
56
  self.data = data
57
57
  self.response_headers = dict(response_headers) if response_headers else None
58
58
  self.kwargs = kwargs
@@ -64,7 +64,7 @@ class VTEXResponseError(VTEXError):
64
64
  "method": self.method,
65
65
  "url": self.url,
66
66
  "request_headers": self.request_headers,
67
- "status": self.status,
67
+ "status_code": self.status_code,
68
68
  "data": self.data,
69
69
  "response_headers": self.response_headers,
70
70
  }
@@ -45,20 +45,20 @@ def log_before_retry(
45
45
 
46
46
  method = str(exception.request.method)
47
47
  url = str(exception.request.url)
48
- status = str(exception.response.status_code)
48
+ status_code = str(exception.response.status_code)
49
49
  reason = str(exception.response.reason_phrase)
50
50
 
51
51
  logger.log(
52
52
  log_level,
53
53
  f"Retrying {method} {url} in {retry_state.next_action.sleep}s as "
54
- f"attempt {retry_state.attempt_number} failed with: {status} {reason}",
54
+ f"attempt {retry_state.attempt_number} failed with: {status_code} {reason}",
55
55
  extra={
56
56
  "exception": exception,
57
57
  "attempt": retry_state.attempt_number,
58
58
  "sleep": retry_state.next_action.sleep,
59
59
  "method": method,
60
60
  "url": url,
61
- "status": status,
61
+ "status_code": status_code,
62
62
  **kwargs,
63
63
  },
64
64
  )
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