wbapi-async 0.6.0__tar.gz → 0.6.2__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.
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/PKG-INFO +1 -1
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/pyproject.toml +1 -1
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/method.py +28 -3
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/.gitignore +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/LICENSE +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/README.md +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/__init__.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/api.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/client/__init__.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/client/session/__init__.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/client/session/base.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/client/session/headers.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/exceptions.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/py.typed +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/type.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/utils/__init__.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/utils/paginate.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/utils/token.py +0 -0
- {wbapi_async-0.6.0 → wbapi_async-0.6.2}/src/wbapi_async/utils/unofficial.py +0 -0
|
@@ -477,8 +477,30 @@ def _get_limiter(path: str) -> AsyncLimiter:
|
|
|
477
477
|
return _limiters[key]
|
|
478
478
|
|
|
479
479
|
|
|
480
|
+
_EXTRA_ALLOWED_HOSTS: frozenset[str] = frozenset(
|
|
481
|
+
{
|
|
482
|
+
"card.wb.ru",
|
|
483
|
+
}
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
|
|
480
487
|
def resolve_url(path: str) -> str:
|
|
481
|
-
"""Resolve full URL for a spec path like /api/v3/supplies.
|
|
488
|
+
"""Resolve full URL for a spec path like /api/v3/supplies.
|
|
489
|
+
|
|
490
|
+
If a full URL is passed, it is returned as-is provided its host is a known
|
|
491
|
+
wildberries.ru domain or is listed in ``_EXTRA_ALLOWED_HOSTS``.
|
|
492
|
+
"""
|
|
493
|
+
from urllib.parse import urlparse
|
|
494
|
+
|
|
495
|
+
from .exceptions import WbAPIError
|
|
496
|
+
|
|
497
|
+
if path.startswith("https://") or path.startswith("http://"):
|
|
498
|
+
host = urlparse(path).netloc
|
|
499
|
+
known_hosts = {urlparse(v).netloc for v in _PATH_TO_BASE.values()} | _EXTRA_ALLOWED_HOSTS
|
|
500
|
+
if host not in known_hosts:
|
|
501
|
+
raise WbAPIError(detail=f"Unknown host {host!r}.")
|
|
502
|
+
return path
|
|
503
|
+
|
|
482
504
|
base = _PATH_TO_BASE.get(path)
|
|
483
505
|
if base:
|
|
484
506
|
return base + path
|
|
@@ -489,8 +511,6 @@ def resolve_url(path: str) -> str:
|
|
|
489
511
|
candidate = "/".join(parts[:i])
|
|
490
512
|
if candidate in _PATH_TO_BASE:
|
|
491
513
|
return _PATH_TO_BASE[candidate] + path
|
|
492
|
-
from .exceptions import WbAPIError
|
|
493
|
-
|
|
494
514
|
raise WbAPIError(detail=f"Unknown path {path!r}. Check available paths at https://dev.wildberries.ru")
|
|
495
515
|
|
|
496
516
|
|
|
@@ -504,6 +524,11 @@ def _extract_list(raw: Any) -> list[Any] | None:
|
|
|
504
524
|
for v in raw.values():
|
|
505
525
|
if isinstance(v, list):
|
|
506
526
|
return v
|
|
527
|
+
for v in raw.values():
|
|
528
|
+
if isinstance(v, dict):
|
|
529
|
+
found = _extract_list(v)
|
|
530
|
+
if found is not None:
|
|
531
|
+
return found
|
|
507
532
|
return None
|
|
508
533
|
|
|
509
534
|
|
|
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
|