python-amazon-sp-api 1.9.60__py3-none-any.whl → 2.0.3__py3-none-any.whl

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.
Files changed (137) hide show
  1. {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/METADATA +41 -14
  2. python_amazon_sp_api-2.0.3.dist-info/RECORD +249 -0
  3. sp_api/__version__.py +1 -1
  4. sp_api/api/catalog/catalog.py +3 -4
  5. sp_api/api/catalog_items/catalog_items.py +3 -6
  6. sp_api/api/data_kiosk/data_kiosk.py +5 -6
  7. sp_api/api/feeds/feeds.py +11 -8
  8. sp_api/api/fulfillment_inbound/fulfillment_inbound.py +2 -2
  9. sp_api/api/inventories/inventories.py +2 -7
  10. sp_api/api/listings_items/listings_items.py +3 -24
  11. sp_api/api/products/products.py +3 -1
  12. sp_api/api/reports/reports.py +61 -97
  13. sp_api/api/sales/sales.py +2 -2
  14. sp_api/asyncio/__init__.py +0 -0
  15. sp_api/asyncio/api/__init__.py +164 -0
  16. sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
  17. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
  18. sp_api/asyncio/api/aplus_content/__init__.py +5 -0
  19. sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
  20. sp_api/asyncio/api/application_integrations/__init__.py +5 -0
  21. sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
  22. sp_api/asyncio/api/application_management/__init__.py +5 -0
  23. sp_api/asyncio/api/application_management/application_management.py +36 -0
  24. sp_api/asyncio/api/authorization/__init__.py +5 -0
  25. sp_api/asyncio/api/authorization/authorization.py +54 -0
  26. sp_api/asyncio/api/catalog/__init__.py +5 -0
  27. sp_api/asyncio/api/catalog/catalog.py +111 -0
  28. sp_api/asyncio/api/catalog_items/__init__.py +6 -0
  29. sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
  30. sp_api/asyncio/api/clients/__init__.py +1 -0
  31. sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
  32. sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
  33. sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
  34. sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
  35. sp_api/asyncio/api/easy_ship/__init__.py +5 -0
  36. sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
  37. sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
  38. sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
  39. sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
  40. sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
  41. sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
  42. sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
  43. sp_api/asyncio/api/feeds/__init__.py +0 -0
  44. sp_api/asyncio/api/feeds/feeds.py +260 -0
  45. sp_api/asyncio/api/finances/__init__.py +0 -0
  46. sp_api/asyncio/api/finances/finances.py +100 -0
  47. sp_api/asyncio/api/fulfillment_inbound/__init__.py +0 -0
  48. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
  49. sp_api/asyncio/api/fulfillment_outbound/__init__.py +0 -0
  50. sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
  51. sp_api/asyncio/api/inventories/__init__.py +0 -0
  52. sp_api/asyncio/api/inventories/inventories.py +74 -0
  53. sp_api/asyncio/api/listings_items/__init__.py +0 -0
  54. sp_api/asyncio/api/listings_items/listings_items.py +170 -0
  55. sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
  56. sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
  57. sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
  58. sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
  59. sp_api/asyncio/api/messaging/__init__.py +0 -0
  60. sp_api/asyncio/api/messaging/messaging.py +511 -0
  61. sp_api/asyncio/api/models/__init__.py +4 -0
  62. sp_api/asyncio/api/notifications/__init__.py +0 -0
  63. sp_api/asyncio/api/notifications/notifications.py +295 -0
  64. sp_api/asyncio/api/orders/__init__.py +0 -0
  65. sp_api/asyncio/api/orders/orders.py +356 -0
  66. sp_api/asyncio/api/overrides/__init__.py +1 -0
  67. sp_api/asyncio/api/product_fees/__init__.py +0 -0
  68. sp_api/asyncio/api/product_fees/product_fees.py +237 -0
  69. sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
  70. sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
  71. sp_api/asyncio/api/products/__init__.py +0 -0
  72. sp_api/asyncio/api/products/products.py +405 -0
  73. sp_api/asyncio/api/products/products_definitions.py +170 -0
  74. sp_api/asyncio/api/replenishment/__init__.py +0 -0
  75. sp_api/asyncio/api/replenishment/replenishment.py +121 -0
  76. sp_api/asyncio/api/reports/__init__.py +0 -0
  77. sp_api/asyncio/api/reports/reports.py +439 -0
  78. sp_api/asyncio/api/sales/__init__.py +0 -0
  79. sp_api/asyncio/api/sales/sales.py +93 -0
  80. sp_api/asyncio/api/sellers/__init__.py +0 -0
  81. sp_api/asyncio/api/sellers/sellers.py +70 -0
  82. sp_api/asyncio/api/services/__init__.py +0 -0
  83. sp_api/asyncio/api/services/services.py +218 -0
  84. sp_api/asyncio/api/shipping/__init__.py +0 -0
  85. sp_api/asyncio/api/shipping/shipping.py +459 -0
  86. sp_api/asyncio/api/shipping/shippingV2.py +651 -0
  87. sp_api/asyncio/api/solicitations/__init__.py +0 -0
  88. sp_api/asyncio/api/solicitations/solicitations.py +78 -0
  89. sp_api/asyncio/api/supply_sources/__init__.py +0 -0
  90. sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
  91. sp_api/asyncio/api/tokens/__init__.py +0 -0
  92. sp_api/asyncio/api/tokens/tokens.py +65 -0
  93. sp_api/asyncio/api/upload/__init__.py +0 -0
  94. sp_api/asyncio/api/upload/upload.py +18 -0
  95. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
  96. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
  97. sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
  98. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
  99. sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
  100. sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
  101. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
  102. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
  103. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
  104. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
  105. sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
  106. sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
  107. sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
  108. sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
  109. sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
  110. sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
  111. sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
  112. sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
  113. sp_api/asyncio/auth/__init__.py +12 -0
  114. sp_api/asyncio/auth/access_token_client.py +145 -0
  115. sp_api/asyncio/auth/exceptions.py +5 -0
  116. sp_api/asyncio/base/__init__.py +53 -0
  117. sp_api/asyncio/base/_transport_httpx.py +50 -0
  118. sp_api/asyncio/base/base_client.py +8 -0
  119. sp_api/asyncio/base/client.py +169 -0
  120. sp_api/asyncio/util/__init__.py +29 -0
  121. sp_api/asyncio/util/key_maker.py +5 -0
  122. sp_api/asyncio/util/load_all_pages.py +55 -0
  123. sp_api/asyncio/util/load_date_bound.py +53 -0
  124. sp_api/asyncio/util/retry.py +88 -0
  125. sp_api/auth/_core.py +39 -0
  126. sp_api/auth/access_token_client.py +18 -30
  127. sp_api/base/_core.py +110 -0
  128. sp_api/base/_transport_httpx.py +39 -0
  129. sp_api/base/client.py +40 -63
  130. sp_api/util/__init__.py +16 -0
  131. sp_api/util/params.py +57 -0
  132. sp_api/util/report_document.py +154 -0
  133. python_amazon_sp_api-1.9.60.dist-info/RECORD +0 -133
  134. {python_amazon_sp_api-1.9.60.data → python_amazon_sp_api-2.0.3.data}/scripts/make_endpoint +0 -0
  135. {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/WHEEL +0 -0
  136. {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/licenses/LICENSE +0 -0
  137. {python_amazon_sp_api-1.9.60.dist-info → python_amazon_sp_api-2.0.3.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,7 @@
1
- import zlib
2
- from collections import abc
3
1
  from datetime import datetime
4
- from io import BytesIO, StringIO
5
2
  from typing import Optional, Union
6
3
 
7
- import requests
4
+ import httpx
8
5
 
9
6
  from sp_api.base import (
10
7
  Client,
@@ -13,6 +10,19 @@ from sp_api.base import (
13
10
  ApiResponse,
14
11
  Marketplaces,
15
12
  )
13
+ from sp_api.util import (
14
+ normalize_csv_param,
15
+ normalize_datetime_kwargs,
16
+ normalize_marketplace_ids,
17
+ should_add_marketplace,
18
+ )
19
+ from sp_api.util.report_document import (
20
+ decode_document,
21
+ decompress_bytes,
22
+ handle_file,
23
+ resolve_character_code,
24
+ stream_to_file_sync,
25
+ )
16
26
 
17
27
 
18
28
  class Reports(Client):
@@ -60,42 +70,16 @@ class Reports(Client):
60
70
  Returns:
61
71
  ApiResponse
62
72
  """
63
- if (
64
- kwargs.get("reportTypes", None)
65
- and isinstance(kwargs.get("reportTypes"), abc.Iterable)
66
- and not isinstance(kwargs.get("reportTypes"), str)
67
- ):
68
- kwargs.update({"reportTypes": ",".join(kwargs.get("reportTypes"))})
69
- if (
70
- kwargs.get("processingStatuses", None)
71
- and isinstance(kwargs.get("processingStatuses"), abc.Iterable)
72
- and not isinstance(kwargs.get("processingStatuses"), str)
73
- ):
74
- kwargs.update(
75
- {"processingStatuses": ",".join(kwargs.get("processingStatuses"))}
76
- )
77
- if (
78
- kwargs.get("marketplaceIds", None)
79
- and isinstance(kwargs.get("marketplaceIds"), abc.Iterable)
80
- and not isinstance(kwargs.get("marketplaceIds"), str)
81
- ):
82
- marketplaces = kwargs.get("marketplaceIds")
83
- kwargs.update(
84
- {
85
- "marketplaceIds": ",".join(
86
- [
87
- m.marketplace_id if isinstance(m, Marketplaces) else m
88
- for m in marketplaces
89
- ]
90
- )
91
- }
92
- )
93
- for k in ["createdSince", "createdUntil"]:
94
- if kwargs.get(k, None) and isinstance(kwargs.get(k), datetime):
95
- kwargs.update({k: kwargs.get(k).isoformat()})
96
- if not kwargs.get("nextToken"):
97
- return self._request(kwargs.pop("path"), params=kwargs)
98
- return self._request(kwargs.pop("path"), params=kwargs, add_marketplace=False)
73
+ normalize_csv_param(kwargs, "reportTypes")
74
+ normalize_csv_param(kwargs, "processingStatuses")
75
+ normalize_marketplace_ids(kwargs, marketplace_cls=Marketplaces)
76
+ normalize_datetime_kwargs(kwargs, ["createdSince", "createdUntil"])
77
+ add_marketplace = should_add_marketplace(kwargs, "nextToken")
78
+ return self._request(
79
+ kwargs.pop("path"),
80
+ params=kwargs,
81
+ add_marketplace=add_marketplace,
82
+ )
99
83
 
100
84
  @sp_endpoint("/reports/2021-06-30/reports", method="POST")
101
85
  def create_report(self, **kwargs) -> ApiResponse:
@@ -134,10 +118,7 @@ class Reports(Client):
134
118
  Returns:
135
119
  ApiResponse
136
120
  """
137
- if isinstance(kwargs.get("dataStartTime", None), datetime):
138
- kwargs.update({"dataStartTime": kwargs.get("dataStartTime").isoformat()})
139
- if isinstance(kwargs.get("dataEndTime", None), datetime):
140
- kwargs.update({"dataEndTime": kwargs.get("dataEndTime").isoformat()})
121
+ normalize_datetime_kwargs(kwargs, ["dataStartTime", "dataEndTime"])
141
122
  return self._request(kwargs.pop("path"), data=kwargs)
142
123
 
143
124
  @sp_endpoint("/reports/2021-06-30/reports/{}", method="DELETE")
@@ -223,12 +204,7 @@ class Reports(Client):
223
204
  Returns:
224
205
  ApiResponse
225
206
  """
226
- if (
227
- kwargs.get("reportTypes", None)
228
- and isinstance(kwargs.get("reportTypes"), abc.Iterable)
229
- and not isinstance(kwargs.get("reportTypes"), str)
230
- ):
231
- kwargs.update({"reportTypes": ",".join(kwargs.get("reportTypes"))})
207
+ normalize_csv_param(kwargs, "reportTypes")
232
208
 
233
209
  return self._request(kwargs.pop("path"), params=kwargs)
234
210
 
@@ -371,6 +347,7 @@ class Reports(Client):
371
347
  download: bool = False,
372
348
  file=None,
373
349
  character_code: Optional[str] = None,
350
+ stream: bool = False,
374
351
  timeout: Optional[Union[float,int]] = None,
375
352
  **kwargs
376
353
  ) -> ApiResponse:
@@ -410,6 +387,7 @@ class Reports(Client):
410
387
  obtaining the document from the document URL.
411
388
  It fallbacks to 'iso-8859-1' if no encoding was found.
412
389
  Only valid if decrypt=True.
390
+ stream: bool | if True and file is provided, stream the document to disk
413
391
  timeout: int | optional, the timeout for the request to download the document
414
392
 
415
393
  Returns:
@@ -420,54 +398,40 @@ class Reports(Client):
420
398
  add_marketplace=False,
421
399
  )
422
400
  if download or file or ("decrypt" in kwargs and kwargs["decrypt"]):
423
- document_response = requests.get(
424
- res.payload.get("url"),
401
+ compression_algorithm = res.payload.get("compressionAlgorithm")
402
+ with httpx.Client(
425
403
  proxies=self.proxies,
426
404
  verify=self.verify,
427
405
  timeout=timeout,
428
- )
429
- document = document_response.content
430
- if not character_code:
431
- character_code = (
432
- document_response.encoding
433
- if document_response and document_response.encoding
434
- else "iso-8859-1"
435
- )
436
- if character_code.lower() == "windows-31j":
437
- character_code = "cp932"
438
- if "compressionAlgorithm" in res.payload:
439
- try:
440
- document = zlib.decompress(bytearray(document), 15 + 32)
441
- except Exception as e:
442
- print(e)
443
- pass
444
-
445
- if character_code:
446
- try:
447
- decoded_document = document.decode(character_code)
448
- except Exception as e:
449
- decoded_document = document
450
-
451
- if download:
452
- res.payload.update(
453
- {
454
- "document": decoded_document,
455
- }
456
- )
457
- if file:
458
- self._handle_file(file, decoded_document, character_code)
406
+ ) as client:
407
+ if stream and file:
408
+ with client.stream("GET", res.payload.get("url")) as document_response:
409
+ if not character_code:
410
+ character_code = resolve_character_code(
411
+ document_response.encoding, fallback="iso-8859-1"
412
+ )
413
+ stream_to_file_sync(
414
+ document_response,
415
+ file,
416
+ character_code,
417
+ compression_algorithm,
418
+ )
419
+ else:
420
+ document_response = client.get(res.payload.get("url"))
421
+ if not character_code:
422
+ character_code = resolve_character_code(
423
+ document_response.encoding, fallback="iso-8859-1"
424
+ )
425
+ document = decompress_bytes(
426
+ document_response.content, compression_algorithm
427
+ )
428
+ decoded_document = decode_document(document, character_code)
429
+ if download:
430
+ res.payload.update(
431
+ {
432
+ "document": decoded_document,
433
+ }
434
+ )
435
+ if file:
436
+ handle_file(file, decoded_document, character_code)
459
437
  return res
460
-
461
- @staticmethod
462
- def _handle_file(file, document, encoding):
463
- if isinstance(file, str):
464
- with open(file, "w+", encoding=encoding) as text_file:
465
- text_file.write(document)
466
- elif isinstance(file, BytesIO):
467
- file.write(document.encode(encoding))
468
- file.seek(0)
469
- elif isinstance(file, StringIO):
470
- file.write(document)
471
- file.seek(0)
472
- else:
473
- file.write(document)
sp_api/api/sales/sales.py CHANGED
@@ -3,6 +3,7 @@ from datetime import datetime
3
3
 
4
4
  from sp_api.base import Client, Marketplaces, sp_endpoint, Granularity, ApiResponse
5
5
  import logging
6
+ from sp_api.util import encode_kwarg
6
7
 
7
8
 
8
9
  class Sales(Client):
@@ -71,8 +72,7 @@ class Sales(Client):
71
72
  )
72
73
  if granularityTimeZone:
73
74
  kwargs.update({"granularityTimeZone": granularityTimeZone})
74
- if "sku" in kwargs:
75
- kwargs.update({"sku": urllib.parse.quote(kwargs.pop("sku"), safe="")})
75
+ encode_kwarg(kwargs, "sku", lambda value: urllib.parse.quote(value, safe=""))
76
76
  return self._request(kwargs.pop("path"), params=kwargs)
77
77
 
78
78
  @staticmethod
File without changes
@@ -0,0 +1,164 @@
1
+ from .finances.finances import Finances, FinancesVersion
2
+ from .notifications.notifications import Notifications
3
+ from .orders.orders import Orders
4
+ from .product_fees.product_fees import ProductFees
5
+ from .sellers.sellers import Sellers
6
+ from .reports.reports import Reports
7
+ from .reports.reports import Reports as ReportsV2
8
+
9
+ from .products.products import Products
10
+ from .sales.sales import Sales
11
+ from .catalog.catalog import Catalog
12
+ from .feeds.feeds import Feeds
13
+ from .feeds.feeds import Feeds as FeedsV2
14
+
15
+ from .inventories.inventories import Inventories
16
+ from .fulfillment_inbound.fulfillment_inbound import (
17
+ FulfillmentInbound,
18
+ FulfillmentInboundVersion,
19
+ )
20
+ from .upload.upload import Upload
21
+ from .messaging.messaging import Messaging
22
+ from .merchant_fulfillment.merchant_fulfillment import MerchantFulfillment
23
+
24
+ ##### DO NOT DELETE ########## INSERT IMPORT HERE #######
25
+ from .application_integrations.application_integrations import ApplicationIntegrations
26
+
27
+ from .easy_ship.easy_ship import EasyShip
28
+
29
+ from .customer_feedback.customer_feedback import CustomerFeedback
30
+
31
+ from .listings_restrictions.listings_restrictions import ListingsRestrictions
32
+
33
+ from .messaging.messaging import Messaging
34
+
35
+ from .catalog_items.catalog_items import CatalogItems, CatalogItemsVersion
36
+
37
+ from .product_type_definitions.product_type_definitions import ProductTypeDefinitions
38
+
39
+ from .listings_items.listings_items import ListingsItems
40
+
41
+ from .vendor_transaction_status.vendor_transaction_status import VendorTransactionStatus
42
+
43
+ from .vendor_shipments.vendor_shipments import VendorShipments
44
+
45
+ from .vendor_orders.vendor_orders import VendorOrders
46
+
47
+ from .vendor_invoices.vendor_invoices import VendorInvoices
48
+
49
+ from .vendor_direct_fulfillment_transactions.vendor_direct_fulfillment_transactions import (
50
+ VendorDirectFulfillmentTransactions,
51
+ )
52
+
53
+ from .vendor_direct_fulfillment_shipping.vendor_direct_fulfillment_shipping import (
54
+ VendorDirectFulfillmentShipping,
55
+ )
56
+
57
+ from .vendor_direct_fulfillment_payments.vendor_direct_fulfillment_payments import (
58
+ VendorDirectFulfillmentPayments,
59
+ )
60
+
61
+ from .vendor_direct_fulfillment_orders.vendor_direct_fulfillment_orders import (
62
+ VendorDirectFulfillmentOrders,
63
+ )
64
+
65
+ from .vendor_direct_fulfillment_inventory.vendor_direct_fulfillment_inventory import (
66
+ VendorDirectFulfillmentInventory,
67
+ )
68
+
69
+ from .tokens.tokens import Tokens
70
+
71
+ from .solicitations.solicitations import Solicitations
72
+
73
+ from .shipping.shipping import Shipping
74
+
75
+ from .services.services import Services
76
+
77
+ from .fba_small_and_light.fba_small_and_light import FbaSmallAndLight
78
+
79
+ from .fba_inbound_eligibility.fba_inbound_eligibility import FbaInboundEligibility
80
+
81
+ from .authorization.authorization import Authorization
82
+
83
+ from .aplus_content.aplus_content import AplusContent
84
+
85
+ from .fulfillment_outbound.fulfillment_outbound import FulfillmentOutbound
86
+
87
+ from .replenishment.replenishment import Replenishment
88
+
89
+ from .supply_sources.supply_sources import SupplySources
90
+
91
+ from .data_kiosk.data_kiosk import DataKiosk
92
+
93
+ from .application_management.application_management import ApplicationManagement
94
+
95
+ from .amazon_warehousing_and_distribu.amazon_warehousing_and_distribu import (
96
+ AmazonWarehousingAndDistribution,
97
+ AmazonWarehousingAndDistributionVersion,
98
+ )
99
+
100
+ from .external_fulfillment.external_fulfillment import ExternalFulfillment
101
+
102
+ __all__ = [
103
+ "Sales",
104
+ "Products",
105
+ "Reports",
106
+ "Orders",
107
+ "Sellers",
108
+ "Notifications",
109
+ "ProductFees",
110
+ "Finances",
111
+ "Catalog",
112
+ "Feeds",
113
+ "Inventories",
114
+ "FulfillmentInbound",
115
+ "Upload",
116
+ "Messaging",
117
+ "FulfillmentInbound",
118
+ "MerchantFulfillment",
119
+ ##### DO NOT DELETE ########## INSERT TITLE HERE #######
120
+ "ExternalFulfillment",
121
+ "ApplicationIntegrations",
122
+ "CustomerFeedback",
123
+ "FulfillmentInbound",
124
+
125
+ "EasyShip",
126
+
127
+
128
+ "FulfillmentInbound",
129
+ "FinancesVersion",
130
+ "ListingsRestrictions",
131
+ "CatalogItemsVersion",
132
+ "AmazonWarehousingAndDistributionVersion",
133
+ "FulfillmentInboundVersion",
134
+ "Feeds",
135
+ "FeedsV2",
136
+ "ReportsV2",
137
+ "Messaging",
138
+ "CatalogItems",
139
+ "ProductTypeDefinitions",
140
+ "ListingsItems",
141
+ "VendorTransactionStatus",
142
+ "VendorShipments",
143
+ "VendorOrders",
144
+ "VendorInvoices",
145
+ "VendorDirectFulfillmentTransactions",
146
+ "VendorDirectFulfillmentShipping",
147
+ "VendorDirectFulfillmentPayments",
148
+ "VendorDirectFulfillmentOrders",
149
+ "VendorDirectFulfillmentInventory",
150
+ "Tokens",
151
+ "Solicitations",
152
+ "Shipping",
153
+ "Services",
154
+ "FbaSmallAndLight",
155
+ "FbaInboundEligibility",
156
+ "Authorization",
157
+ "AplusContent",
158
+ "FulfillmentOutbound",
159
+ "Replenishment",
160
+ "SupplySources",
161
+ "DataKiosk",
162
+ "ApplicationManagement",
163
+ "AmazonWarehousingAndDistribution",
164
+ ]
@@ -0,0 +1,9 @@
1
+ from .amazon_warehousing_and_distribu import (
2
+ AmazonWarehousingAndDistribution,
3
+ AmazonWarehousingAndDistributionVersion,
4
+ )
5
+
6
+ __all__ = [
7
+ "AmazonWarehousingAndDistribution",
8
+ "AmazonWarehousingAndDistributionVersion",
9
+ ]
@@ -0,0 +1,130 @@
1
+ import enum
2
+ import urllib.parse
3
+
4
+ from sp_api.base import ApiResponse, fill_query_params, sp_endpoint
5
+ from sp_api.asyncio.base import AsyncBaseClient
6
+
7
+
8
+ class AmazonWarehousingAndDistributionVersion(str, enum.Enum):
9
+ V_2024_05_09 = "2024-05-09"
10
+ LATEST = "2024-05-09"
11
+
12
+
13
+ class AmazonWarehousingAndDistribution(AsyncBaseClient):
14
+ """
15
+ AmazonWarehousingAndDistribu SP-API Client
16
+ :link:
17
+
18
+ The Selling Partner API for Amazon Warehousing and Distribution (AWD).
19
+ """
20
+
21
+ version: AmazonWarehousingAndDistributionVersion = (
22
+ AmazonWarehousingAndDistributionVersion.V_2024_05_09
23
+ )
24
+
25
+ def __init__(self, *args, **kwargs):
26
+ if "version" in kwargs:
27
+ self.version = kwargs.get(
28
+ "version", AmazonWarehousingAndDistributionVersion.V_2024_05_09
29
+ )
30
+ super().__init__(*args, **{**kwargs, "version": self.version})
31
+
32
+ @sp_endpoint("/awd/<version>/inboundShipments/{}", method="GET")
33
+ async def get_inbound_shipment(self, shipmentId, **kwargs) -> ApiResponse:
34
+ """
35
+ get_inbound_shipment(self, shipmentId, **kwargs) -> ApiResponse
36
+
37
+ Retrieves an AWD inbound shipment.
38
+
39
+ **Usage Plan:**
40
+
41
+ | Rate (requests per second) | Burst |
42
+ | ---- | ---- |
43
+ | 2 | 2 |
44
+
45
+ The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api)
46
+
47
+ Args:
48
+
49
+ shipmentId:string | * REQUIRED ID for the shipment. A shipment contains the cases being inbounded.
50
+
51
+
52
+ Returns:
53
+ ApiResponse:
54
+ """
55
+
56
+ return await self._request(
57
+ fill_query_params(kwargs.pop("path"), shipmentId), params=kwargs
58
+ )
59
+
60
+ @sp_endpoint("/awd/<version>/inboundShipments", method="GET")
61
+ async def list_inbound_shipments(self, **kwargs) -> ApiResponse:
62
+ """
63
+ list_inbound_shipments(self, **kwargs) -> ApiResponse
64
+
65
+ Retrieves a summary for all the inbound AWD shipments associated with a merchant, with the ability to apply optional filters.
66
+
67
+ **Usage Plan:**
68
+
69
+ | Rate (requests per second) | Burst |
70
+ | ---- | ---- |
71
+ | 1 | 1 |
72
+
73
+ The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
74
+
75
+ Args:
76
+
77
+ key sortBy:string | Field to sort results by. Required if `sortOrder` is provided.
78
+
79
+ key sortOrder:string | Sort the response in `ASCENDING` or `DESCENDING` order.
80
+
81
+ key shipmentStatus:string | Filter by inbound shipment status.
82
+
83
+ key updatedAfter:string | List the inbound shipments that were updated after a certain time (inclusive). The date must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
84
+
85
+ key updatedBefore:string | List the inbound shipments that were updated before a certain time (inclusive). The date must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
86
+
87
+ key maxResults:integer | Maximum number of results to return.
88
+
89
+ key nextToken:string | Token to retrieve the next set of paginated results.
90
+
91
+
92
+ Returns:
93
+ ApiResponse:
94
+ """
95
+
96
+ return await self._request(kwargs.pop("path"), params=kwargs)
97
+
98
+ @sp_endpoint("/awd/<version>/inventory", method="GET")
99
+ async def list_inventory(self, **kwargs) -> ApiResponse:
100
+ """
101
+ list_inventory(self, **kwargs) -> ApiResponse
102
+
103
+ Lists AWD inventory associated with a merchant with the ability to apply optional filters.
104
+
105
+ **Usage Plan:**
106
+
107
+ | Rate (requests per second) | Burst |
108
+ | ---- | ---- |
109
+ | 2 | 2 |
110
+
111
+ The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
112
+
113
+ Args:
114
+
115
+ key sku:string | Filter by seller or merchant SKU for the item.
116
+
117
+ key sortOrder:string | Sort the response in `ASCENDING` or `DESCENDING` order.
118
+
119
+ key details:string | Set to `SHOW` to return summaries with additional inventory details. Defaults to `HIDE,` which returns only inventory summary totals.
120
+
121
+ key nextToken:string | Token to retrieve the next set of paginated results.
122
+
123
+ key maxResults:integer | Maximum number of results to return.
124
+
125
+
126
+ Returns:
127
+ ApiResponse:
128
+ """
129
+
130
+ return await self._request(kwargs.pop("path"), params=kwargs)
@@ -0,0 +1,5 @@
1
+ from .aplus_content import AplusContent
2
+
3
+ __all__ = [
4
+ "AplusContent",
5
+ ]