vtexpy 0.0.0b7__tar.gz → 0.0.0b9__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 (26) hide show
  1. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/PKG-INFO +1 -1
  2. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/pyproject.toml +1 -1
  3. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/base.py +5 -2
  4. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_logging.py +9 -7
  5. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_utils.py +4 -9
  6. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_vtex.py +2 -2
  7. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/LICENSE +0 -0
  8. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/README.md +0 -0
  9. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/__init__.py +0 -0
  10. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/__init__.py +0 -0
  11. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/catalog.py +0 -0
  12. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/checkout.py +0 -0
  13. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/custom.py +0 -0
  14. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/license_manager.py +0 -0
  15. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/logistics.py +0 -0
  16. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/master_data.py +0 -0
  17. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/orders.py +0 -0
  18. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/payments_gateway.py +0 -0
  19. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_api/promotions_and_taxes.py +0 -0
  20. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_config.py +0 -0
  21. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_constants.py +0 -0
  22. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_dto.py +0 -0
  23. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_exceptions.py +0 -0
  24. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_sentinels.py +0 -0
  25. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/_types.py +0 -0
  26. {vtexpy-0.0.0b7 → vtexpy-0.0.0b9}/vtex/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vtexpy
3
- Version: 0.0.0b7
3
+ Version: 0.0.0b9
4
4
  Summary: Unofficial Python SDK for VTEX API
5
5
  Home-page: https://github.com/lvieirajr/vtex-python
6
6
  License: MIT
@@ -32,7 +32,7 @@ classifiers = [
32
32
  packages = [
33
33
  {include = "vtex"},
34
34
  ]
35
- version = "0.0.0b7"
35
+ version = "0.0.0b9"
36
36
 
37
37
  [build-system]
38
38
  requires = ["poetry-core"]
@@ -32,7 +32,7 @@ from .._dto import VTEXResponse, VTEXResponseType
32
32
  from .._exceptions import VTEXRequestError, VTEXResponseError
33
33
  from .._logging import get_logger, log_before_retry
34
34
  from .._types import HTTPMethodType
35
- from .._utils import redact_headers, to_snake_case_deep
35
+ from .._utils import redact_headers, to_snake_case, to_snake_case_deep
36
36
 
37
37
 
38
38
  class BaseAPI:
@@ -46,7 +46,10 @@ class BaseAPI:
46
46
  logger: Union[Logger, None] = None,
47
47
  ) -> None:
48
48
  self._config = config or Config()
49
- self._logger = get_logger(type(self).__name__, logger=logger)
49
+ self._logger = get_logger(
50
+ name=to_snake_case(type(self).__name__),
51
+ parent=logger,
52
+ )
50
53
 
51
54
  def _request(
52
55
  self,
@@ -5,14 +5,11 @@ from httpx import HTTPStatusError
5
5
  from tenacity import RetryCallState
6
6
 
7
7
 
8
- def get_logger(name: str, logger: Union[Logger, None] = None) -> Logger:
9
- from ._utils import to_snake_case
8
+ def get_logger(name: str, parent: Union[Logger, None] = None) -> Logger:
9
+ if parent:
10
+ return parent.getChild(name)
10
11
 
11
- name = to_snake_case(name)
12
- if logger:
13
- return logger.getChild(name)
14
-
15
- return getLogger(f"vtex.{to_snake_case(name)}")
12
+ return getLogger(f"vtex.{name}")
16
13
 
17
14
 
18
15
  def log_before_retry(
@@ -45,3 +42,8 @@ def log_before_retry(
45
42
  )
46
43
 
47
44
  return retry_log
45
+
46
+
47
+ CLIENT_LOGGER = get_logger(name="client")
48
+ EXCEPTIONS_LOGGER = get_logger(name="exceptions")
49
+ UTILS_LOGGER = get_logger(name="utils")
@@ -6,7 +6,7 @@ from uuid import UUID
6
6
  from distutils.util import strtobool
7
7
 
8
8
  from ._constants import APP_KEY_HEADER, APP_TOKEN_HEADER
9
- from ._logging import get_logger
9
+ from ._logging import UTILS_LOGGER
10
10
  from ._sentinels import UNDEFINED
11
11
  from ._types import JSONType
12
12
 
@@ -43,22 +43,17 @@ def to_snake_case(string: str) -> str:
43
43
 
44
44
 
45
45
  def to_snake_case_deep(obj: JSONType) -> JSONType:
46
- logger = get_logger("utils")
47
-
48
46
  if isinstance(obj, dict):
49
47
  snake_cased_obj = {}
50
48
 
51
- for key, value in sorted(
52
- obj.items(),
53
- key=lambda item: [(int(c.isupper()), c.lower()) for c in item[0]],
54
- ):
49
+ for key, value in sorted(obj.items(), key=lambda item: item[0]):
55
50
  if isinstance(key, str):
56
51
  key = to_snake_case(remove_null_bytes(key))
57
52
 
58
53
  while key in snake_cased_obj:
59
- logger.debug(
54
+ UTILS_LOGGER.debug(
60
55
  f"Snake cased key {key} appears multiple times in object",
61
- extra=obj,
56
+ extra={"object": obj, "key": key},
62
57
  )
63
58
  key = f"_{key}"
64
59
 
@@ -13,7 +13,7 @@ from ._api import (
13
13
  PromotionsAndTaxesAPI,
14
14
  )
15
15
  from ._config import Config # type: ignore[attr-defined]
16
- from ._logging import get_logger
16
+ from ._logging import CLIENT_LOGGER
17
17
  from ._sentinels import UNDEFINED, UndefinedSentinel
18
18
  from ._types import IterableType
19
19
 
@@ -38,7 +38,7 @@ class VTEX:
38
38
  retry_logs: Union[bool, UndefinedSentinel] = UNDEFINED,
39
39
  raise_for_status: Union[bool, UndefinedSentinel] = UNDEFINED,
40
40
  ) -> None:
41
- self._logger = get_logger("client")
41
+ self._logger = CLIENT_LOGGER
42
42
  self._config = Config(
43
43
  account_name=account_name,
44
44
  app_key=app_key,
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