wbapi-async 0.7.7__tar.gz → 0.7.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbapi-async
3
- Version: 0.7.7
3
+ Version: 0.7.8
4
4
  Summary: Fast, lightweight async client for the Wildberries Seller API
5
5
  Project-URL: Documentation, https://serdukow.github.io/wbapi-async/
6
6
  Project-URL: Repository, https://github.com/serdukow/wbapi-async
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "wbapi-async"
7
- version = "0.7.7"
7
+ version = "0.7.8"
8
8
  description = "Fast, lightweight async client for the Wildberries Seller API"
9
9
 
10
10
  authors = [
@@ -19,6 +19,24 @@ class PaginationStrategy:
19
19
  raise NotImplementedError
20
20
 
21
21
 
22
+ class RrdIdBodyCursorStrategy(PaginationStrategy):
23
+ def detect(self, raw: Any, page: list[Any], body: Any, page_size: int, path: str) -> bool:
24
+ return bool(body is not None and page and isinstance(page[-1], dict) and "rrdId" in page[-1])
25
+
26
+ async def paginate(
27
+ self, result: list[Any], page: list[Any], raw: Any, request: _Requester, page_size: int, body: Any
28
+ ) -> list[Any]:
29
+ from .._method import _extract_list
30
+
31
+ while len(page) >= page_size:
32
+ rrd_id = page[-1]["rrdId"]
33
+ page = _extract_list(await request(extra_body={"rrdId": rrd_id})) or []
34
+ if not page:
35
+ break
36
+ result.extend(page)
37
+ return result
38
+
39
+
22
40
  class RrdIdCursorStrategy(PaginationStrategy):
23
41
  def detect(self, raw: Any, page: list[Any], body: Any, page_size: int, path: str) -> bool:
24
42
  return bool(page and isinstance(page[-1], dict) and "rrd_id" in page[-1])
@@ -147,6 +165,7 @@ class CardsListStrategy(PaginationStrategy):
147
165
 
148
166
  PAGINATION_STRATEGIES: list[PaginationStrategy] = [
149
167
  CardsListStrategy(),
168
+ RrdIdBodyCursorStrategy(),
150
169
  RrdIdCursorStrategy(),
151
170
  LastChangeDateStrategy(),
152
171
  BodyCursorStrategy(),
File without changes
File without changes
File without changes