python-amazon-sp-api 1.7.5__py3-none-any.whl → 2.0.10__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 (214) hide show
  1. {python_amazon_sp_api-1.7.5.data → python_amazon_sp_api-2.0.10.data}/scripts/make_endpoint +2 -2
  2. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/METADATA +58 -8
  3. python_amazon_sp_api-2.0.10.dist-info/RECORD +253 -0
  4. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/WHEEL +1 -1
  5. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info}/top_level.txt +0 -1
  6. sp_api/__version__.py +1 -1
  7. sp_api/api/__init__.py +48 -41
  8. sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +82 -76
  9. sp_api/api/aplus_content/aplus_content.py +76 -45
  10. sp_api/api/application_integrations/application_integrations.py +118 -0
  11. sp_api/api/application_management/application_management.py +6 -7
  12. sp_api/api/authorization/authorization.py +5 -5
  13. sp_api/api/catalog/catalog.py +9 -10
  14. sp_api/api/catalog_items/catalog_items.py +10 -13
  15. sp_api/api/customer_feedback/customer_feedback.py +110 -0
  16. sp_api/api/data_kiosk/data_kiosk.py +59 -39
  17. sp_api/api/easy_ship/easy_ship.py +190 -0
  18. sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
  19. sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py +23 -13
  20. sp_api/api/fba_small_and_light/fba_small_and_light.py +46 -20
  21. sp_api/api/feeds/feeds.py +60 -39
  22. sp_api/api/finances/finances.py +40 -9
  23. sp_api/api/fulfillment_inbound/fulfillment_inbound.py +844 -619
  24. sp_api/api/fulfillment_outbound/fulfillment_outbound.py +63 -57
  25. sp_api/api/inventories/inventories.py +13 -11
  26. sp_api/api/listings_items/listings_items.py +38 -25
  27. sp_api/api/listings_restrictions/listings_restrictions.py +6 -7
  28. sp_api/api/merchant_fulfillment/merchant_fulfillment.py +49 -36
  29. sp_api/api/messaging/messaging.py +129 -25
  30. sp_api/api/notifications/notifications.py +85 -45
  31. sp_api/api/orders/orders.py +123 -38
  32. sp_api/api/orders/orders_2026_01_01.py +54 -0
  33. sp_api/api/product_fees/product_fees.py +75 -67
  34. sp_api/api/product_type_definitions/product_type_definitions.py +9 -10
  35. sp_api/api/products/products.py +177 -53
  36. sp_api/api/products/products_definitions.py +11 -82
  37. sp_api/api/replenishment/replenishment.py +13 -11
  38. sp_api/api/reports/reports.py +113 -95
  39. sp_api/api/sales/sales.py +23 -13
  40. sp_api/api/sellers/sellers.py +3 -3
  41. sp_api/api/services/services.py +41 -30
  42. sp_api/api/shipping/shipping.py +39 -37
  43. sp_api/api/shipping/shippingV2.py +46 -30
  44. sp_api/api/solicitations/solicitations.py +20 -11
  45. sp_api/api/supply_sources/supply_sources.py +45 -37
  46. sp_api/api/tokens/tokens.py +4 -6
  47. sp_api/api/upload/upload.py +10 -8
  48. sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +10 -6
  49. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +12 -14
  50. sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +4 -6
  51. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +42 -37
  52. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +8 -6
  53. sp_api/api/vendor_invoices/vendor_invoices.py +6 -4
  54. sp_api/api/vendor_orders/vendor_orders.py +16 -19
  55. sp_api/api/vendor_shipments/vendor_shipments.py +91 -262
  56. sp_api/api/vendor_transaction_status/vendor_transaction_status.py +6 -6
  57. sp_api/asyncio/api/__init__.py +167 -0
  58. sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
  59. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
  60. sp_api/asyncio/api/aplus_content/__init__.py +5 -0
  61. sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
  62. sp_api/asyncio/api/application_integrations/__init__.py +5 -0
  63. sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
  64. sp_api/asyncio/api/application_management/__init__.py +5 -0
  65. sp_api/asyncio/api/application_management/application_management.py +36 -0
  66. sp_api/asyncio/api/authorization/__init__.py +5 -0
  67. sp_api/asyncio/api/authorization/authorization.py +54 -0
  68. sp_api/asyncio/api/catalog/__init__.py +5 -0
  69. sp_api/asyncio/api/catalog/catalog.py +111 -0
  70. sp_api/asyncio/api/catalog_items/__init__.py +6 -0
  71. sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
  72. sp_api/asyncio/api/clients/__init__.py +1 -0
  73. sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
  74. sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
  75. sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
  76. sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
  77. sp_api/asyncio/api/easy_ship/__init__.py +5 -0
  78. sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
  79. sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
  80. sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
  81. sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
  82. sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
  83. sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
  84. sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
  85. sp_api/asyncio/api/feeds/feeds.py +260 -0
  86. sp_api/asyncio/api/finances/finances.py +100 -0
  87. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
  88. sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
  89. sp_api/asyncio/api/inventories/inventories.py +74 -0
  90. sp_api/asyncio/api/listings_items/__init__.py +0 -0
  91. sp_api/asyncio/api/listings_items/listings_items.py +170 -0
  92. sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
  93. sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
  94. sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
  95. sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
  96. sp_api/asyncio/api/messaging/__init__.py +0 -0
  97. sp_api/asyncio/api/messaging/messaging.py +511 -0
  98. sp_api/asyncio/api/models/__init__.py +4 -0
  99. sp_api/asyncio/api/notifications/__init__.py +0 -0
  100. sp_api/asyncio/api/notifications/notifications.py +295 -0
  101. sp_api/asyncio/api/orders/__init__.py +0 -0
  102. sp_api/asyncio/api/orders/orders.py +412 -0
  103. sp_api/asyncio/api/orders/orders_2026_01_01.py +40 -0
  104. sp_api/asyncio/api/overrides/__init__.py +1 -0
  105. sp_api/asyncio/api/product_fees/__init__.py +0 -0
  106. sp_api/asyncio/api/product_fees/product_fees.py +194 -0
  107. sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
  108. sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
  109. sp_api/asyncio/api/products/__init__.py +0 -0
  110. sp_api/asyncio/api/products/products.py +405 -0
  111. sp_api/asyncio/api/products/products_definitions.py +11 -0
  112. sp_api/asyncio/api/replenishment/__init__.py +0 -0
  113. sp_api/asyncio/api/replenishment/replenishment.py +121 -0
  114. sp_api/asyncio/api/reports/__init__.py +0 -0
  115. sp_api/asyncio/api/reports/reports.py +439 -0
  116. sp_api/asyncio/api/sales/__init__.py +0 -0
  117. sp_api/asyncio/api/sales/sales.py +93 -0
  118. sp_api/asyncio/api/sellers/__init__.py +0 -0
  119. sp_api/asyncio/api/sellers/sellers.py +70 -0
  120. sp_api/asyncio/api/services/__init__.py +0 -0
  121. sp_api/asyncio/api/services/services.py +218 -0
  122. sp_api/asyncio/api/shipping/__init__.py +0 -0
  123. sp_api/asyncio/api/shipping/shipping.py +459 -0
  124. sp_api/asyncio/api/shipping/shippingV2.py +651 -0
  125. sp_api/asyncio/api/solicitations/__init__.py +0 -0
  126. sp_api/asyncio/api/solicitations/solicitations.py +78 -0
  127. sp_api/asyncio/api/supply_sources/__init__.py +0 -0
  128. sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
  129. sp_api/asyncio/api/tokens/__init__.py +0 -0
  130. sp_api/asyncio/api/tokens/tokens.py +65 -0
  131. sp_api/asyncio/api/upload/__init__.py +0 -0
  132. sp_api/asyncio/api/upload/upload.py +18 -0
  133. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
  134. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
  135. sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
  136. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
  137. sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
  138. sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
  139. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
  140. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
  141. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
  142. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
  143. sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
  144. sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
  145. sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
  146. sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
  147. sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
  148. sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
  149. sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
  150. sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
  151. sp_api/asyncio/auth/__init__.py +12 -0
  152. sp_api/asyncio/auth/access_token_client.py +145 -0
  153. sp_api/asyncio/auth/exceptions.py +5 -0
  154. sp_api/asyncio/base/__init__.py +53 -0
  155. sp_api/asyncio/base/_transport_httpx.py +50 -0
  156. sp_api/asyncio/base/base_client.py +8 -0
  157. sp_api/asyncio/base/client.py +169 -0
  158. sp_api/asyncio/util/__init__.py +29 -0
  159. sp_api/asyncio/util/key_maker.py +5 -0
  160. sp_api/asyncio/util/load_all_pages.py +55 -0
  161. sp_api/asyncio/util/load_date_bound.py +53 -0
  162. sp_api/asyncio/util/retry.py +88 -0
  163. sp_api/auth/__init__.py +3 -3
  164. sp_api/auth/_core.py +39 -0
  165. sp_api/auth/access_token_client.py +20 -31
  166. sp_api/auth/access_token_response.py +4 -4
  167. sp_api/base/ApiResponse.py +5 -4
  168. sp_api/base/__init__.py +53 -42
  169. sp_api/base/_core.py +110 -0
  170. sp_api/base/_transport_httpx.py +39 -0
  171. sp_api/base/base_client.py +4 -4
  172. sp_api/base/client.py +131 -112
  173. sp_api/base/credential_provider.py +41 -34
  174. sp_api/base/exceptions.py +14 -3
  175. sp_api/base/feedTypes.py +44 -32
  176. sp_api/base/fulfillment_channel.py +2 -2
  177. sp_api/base/helpers.py +17 -16
  178. sp_api/base/identifiersType.py +8 -8
  179. sp_api/base/included_data.py +12 -12
  180. sp_api/base/marketplaces.py +5 -1
  181. sp_api/base/notifications.py +1 -1
  182. sp_api/base/processing_status.py +5 -5
  183. sp_api/base/reportTypes.py +198 -111
  184. sp_api/base/sales_enum.py +11 -13
  185. sp_api/util/__init__.py +42 -6
  186. sp_api/util/key_maker.py +4 -2
  187. sp_api/util/load_all_pages.py +16 -5
  188. sp_api/util/load_date_bound.py +28 -13
  189. sp_api/util/params.py +57 -0
  190. sp_api/util/product_fees.py +40 -0
  191. sp_api/util/products_definitions.py +169 -0
  192. sp_api/util/report_document.py +154 -0
  193. sp_api/util/retry.py +16 -15
  194. python_amazon_sp_api-1.7.5.dist-info/RECORD +0 -144
  195. tests/api/finances/test_finances.py +0 -19
  196. tests/api/notifications/test_notifications.py +0 -26
  197. tests/api/orders/test_orders.py +0 -122
  198. tests/api/product_fees/product_fees.py +0 -49
  199. tests/api/reports/test_reports.py +0 -127
  200. tests/client/test_auth.py +0 -59
  201. tests/client/test_base.py +0 -163
  202. tests/client/test_credential_provider.py +0 -45
  203. tests/client/test_helpers.py +0 -142
  204. {python_amazon_sp_api-1.7.5.dist-info → python_amazon_sp_api-2.0.10.dist-info/licenses}/LICENSE +0 -0
  205. {tests → sp_api/api/application_integrations}/__init__.py +0 -0
  206. {tests/api → sp_api/api/customer_feedback}/__init__.py +0 -0
  207. {tests/api/finances → sp_api/api/easy_ship}/__init__.py +0 -0
  208. {tests/api/notifications → sp_api/api/external_fulfillment}/__init__.py +0 -0
  209. {tests/api/orders → sp_api/asyncio}/__init__.py +0 -0
  210. {tests/api/product_fees → sp_api/asyncio/api/feeds}/__init__.py +0 -0
  211. {tests/api/reports → sp_api/asyncio/api/finances}/__init__.py +0 -0
  212. {tests/api/sellers → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
  213. {tests/client → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
  214. /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/inventories/__init__.py +0 -0
@@ -1,6 +1,7 @@
1
1
  import enum
2
2
 
3
3
  from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
4
+ from sp_api.util import normalize_included_data
4
5
 
5
6
 
6
7
  class CatalogItemsVersion(str, enum.Enum):
@@ -20,11 +21,11 @@ class CatalogItems(Client):
20
21
  version: CatalogItemsVersion = CatalogItemsVersion.V_2020_12_01
21
22
 
22
23
  def __init__(self, *args, **kwargs):
23
- if 'version' in kwargs:
24
- self.version = kwargs.get('version', CatalogItemsVersion.V_2020_12_01)
25
- super().__init__(*args, **{**kwargs, 'version': self.version})
24
+ if "version" in kwargs:
25
+ self.version = kwargs.get("version", CatalogItemsVersion.V_2020_12_01)
26
+ super().__init__(*args, **{**kwargs, "version": self.version})
26
27
 
27
- @sp_endpoint('/catalog/<version>/items', method='GET')
28
+ @sp_endpoint("/catalog/<version>/items", method="GET")
28
29
  def search_catalog_items(self, **kwargs) -> ApiResponse:
29
30
  """
30
31
  search_catalog_items(self, **kwargs) -> ApiResponse
@@ -56,12 +57,10 @@ class CatalogItems(Client):
56
57
  ApiResponse:
57
58
  """
58
59
 
59
- includedData = kwargs.get('includedData', [])
60
- if includedData and isinstance(includedData, list):
61
- kwargs['includedData'] = ','.join(includedData)
62
- return self._request(kwargs.pop('path'), params=kwargs)
60
+ normalize_included_data(kwargs)
61
+ return self._request(kwargs.pop("path"), params=kwargs)
63
62
 
64
- @sp_endpoint('/catalog/<version>/items/{}', method='GET')
63
+ @sp_endpoint("/catalog/<version>/items/{}", method="GET")
65
64
  def get_catalog_item(self, asin, **kwargs) -> ApiResponse:
66
65
  """
67
66
  get_catalog_item(self, asin, **kwargs) -> ApiResponse
@@ -87,7 +86,5 @@ class CatalogItems(Client):
87
86
  ApiResponse:
88
87
  """
89
88
 
90
- includedData = kwargs.get('includedData', [])
91
- if includedData and isinstance(includedData, list):
92
- kwargs['includedData'] = ','.join(includedData)
93
- return self._request(fill_query_params(kwargs.pop('path'), asin), params=kwargs)
89
+ normalize_included_data(kwargs)
90
+ return self._request(fill_query_params(kwargs.pop("path"), asin), params=kwargs)
@@ -0,0 +1,110 @@
1
+ from sp_api.base import Client, sp_endpoint, ApiResponse, fill_query_params
2
+
3
+
4
+ class CustomerFeedback(Client):
5
+ """
6
+ The Selling Partner API for CustomerFeedback - 2024-06-01
7
+
8
+ The Selling Partner API for Customer Feedback (Customer Feedback API) provides information about customer reviews and returns at both the item and browse node level.
9
+ """
10
+
11
+ @sp_endpoint(
12
+ "/customerFeedback/2024-06-01/items/{}/reviews/topics", method="GET"
13
+ )
14
+ def get_item_review_topics(
15
+ self, asin, *args, **kwargs
16
+ ) -> ApiResponse:
17
+ """
18
+ Retrieve an item's ten most positive and ten most negative review topics.
19
+ """
20
+
21
+ return self._request(
22
+ fill_query_params(kwargs.pop('path'), asin), params=kwargs
23
+ )
24
+
25
+ @sp_endpoint("/customerFeedback/2024-06-01/items/{}/browseNode", method="GET")
26
+ def get_item_browse_node(self, asin, *args, **kwargs) -> ApiResponse:
27
+ """
28
+ This API returns the associated browse node of the requested ASIN. A browse node is a location in a browse tree that is used for navigation, product classification, and website content on the Amazon retail website.
29
+ """
30
+
31
+ return self._request(
32
+ fill_query_params(kwargs.pop('path'), asin), params=kwargs
33
+ )
34
+
35
+
36
+ @sp_endpoint(
37
+ "/customerFeedback/2024-06-01/browseNodes/{}/reviews/topics",
38
+ method="GET",
39
+ )
40
+ def get_browse_node_review_topics(
41
+ self, browseNodeId, *args, **kwargs
42
+ ) -> ApiResponse:
43
+ """
44
+ Retrieve a browse node's ten most positive and ten most negative review topics.
45
+ """
46
+
47
+ return self._request(
48
+ fill_query_params(kwargs.pop('path'), browseNodeId), params=kwargs
49
+ )
50
+
51
+
52
+ @sp_endpoint(
53
+ "/customerFeedback/2024-06-01/items/{}/reviews/trends", method="GET"
54
+ )
55
+ def get_item_review_trends(
56
+ self, asin, *args, **kwargs
57
+ ) -> ApiResponse:
58
+ """
59
+ Retrieve an item's positive and negative review trends for the past six months.
60
+ """
61
+
62
+ return self._request(
63
+ fill_query_params(kwargs.pop('path'), asin), params=kwargs
64
+ )
65
+
66
+
67
+ @sp_endpoint(
68
+ "/customerFeedback/2024-06-01/browseNodes/{}/reviews/trends",
69
+ method="GET",
70
+ )
71
+ def get_browse_node_review_trends(
72
+ self, browseNodeId, *args, **kwargs
73
+ ) -> ApiResponse:
74
+ """
75
+ Retrieve the positive and negative review trends of items in a browse node for the past six months.
76
+ """
77
+
78
+ return self._request(
79
+ fill_query_params(kwargs.pop('path'), browseNodeId), params=kwargs
80
+ )
81
+
82
+ @sp_endpoint(
83
+ "/customerFeedback/2024-06-01/browseNodes/{}/returns/topics",
84
+ method="GET",
85
+ )
86
+ def get_browse_node_return_topics(
87
+ self, browseNodeId, *args, **kwargs
88
+ ) -> ApiResponse:
89
+ """
90
+ Retrieve the topics that customers mention when they return items in a browse node.
91
+ """
92
+
93
+ return self._request(
94
+ fill_query_params(kwargs.pop('path'), browseNodeId), params=kwargs
95
+ )
96
+
97
+ @sp_endpoint(
98
+ "/customerFeedback/2024-06-01/browseNodes/{}/returns/trends",
99
+ method="GET",
100
+ )
101
+ def get_browse_node_return_trends(
102
+ self, browseNodeId, *args, **kwargs
103
+ ) -> ApiResponse:
104
+ """
105
+ Retrieve the trends of topics that customers mention when they return items in a browse node.
106
+ """
107
+
108
+ return self._request(
109
+ fill_query_params(kwargs.pop('path'), browseNodeId), params=kwargs
110
+ )
@@ -1,3 +1,4 @@
1
+ import httpx
1
2
  import urllib.parse
2
3
  from io import BytesIO, StringIO
3
4
  from typing import Union, BinaryIO, TextIO
@@ -8,12 +9,12 @@ from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
8
9
  class DataKiosk(Client):
9
10
  """
10
11
  DataKiosk SP-API Client
11
- :link:
12
+ :link:
12
13
 
13
14
  The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling partners manage their businesses.
14
15
  """
15
16
 
16
- @sp_endpoint('/dataKiosk/2023-11-15/queries', method='GET')
17
+ @sp_endpoint("/dataKiosk/2023-11-15/queries", method="GET")
17
18
  def get_queries(self, **kwargs) -> ApiResponse:
18
19
  """
19
20
  get_queries(self, **kwargs) -> ApiResponse
@@ -32,25 +33,25 @@ class DataKiosk(Client):
32
33
  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).
33
34
 
34
35
  Args:
35
-
36
+
36
37
  key processingStatuses:array | A list of processing statuses used to filter queries.
37
-
38
+
38
39
  key pageSize:integer | The maximum number of queries to return in a single call.
39
-
40
+
40
41
  key createdSince:string | The earliest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is 90 days ago.
41
-
42
+
42
43
  key createdUntil:string | The latest query creation date and time for queries to include in the response, in ISO 8601 date time format. The default is the time of the `getQueries` request.
43
-
44
+
44
45
  key paginationToken:string | A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the `pagination.nextToken` field returned in the `GetQueriesResponse` object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of `pageSize` which can be modified between calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
45
-
46
+
46
47
 
47
48
  Returns:
48
49
  ApiResponse:
49
50
  """
50
51
 
51
- return self._request(kwargs.pop('path'), params=kwargs, add_marketplace=False)
52
+ return self._request(kwargs.pop("path"), params=kwargs, add_marketplace=False)
52
53
 
53
- @sp_endpoint('/dataKiosk/2023-11-15/queries', method='POST')
54
+ @sp_endpoint("/dataKiosk/2023-11-15/queries", method="POST")
54
55
  def create_query(self, query, pagination_token=None, **kwargs) -> ApiResponse:
55
56
  """
56
57
  create_query(self, query, pagination_token=None, **kwargs) -> ApiResponse
@@ -71,7 +72,7 @@ class DataKiosk(Client):
71
72
  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).
72
73
 
73
74
  Args:
74
-
75
+
75
76
  query:string | * REQUIRED The query to submit. The query must be a valid GraphQL query in the schema specified by the `schema` parameter.
76
77
  pagination_token:string | A token to fetch a certain page of results when there are multiple pages of results available. The value of this token is fetched from the `pagination.nextToken` field returned in the `GetQueriesResponse` object. All other parameters must be provided with the same values that were provided with the request that generated this token, with the exception of `pageSize` which can be modified between calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
77
78
 
@@ -79,12 +80,12 @@ class DataKiosk(Client):
79
80
  Returns:
80
81
  ApiResponse:
81
82
  """
82
- kwargs['query'] = query
83
+ kwargs["query"] = query
83
84
  if pagination_token:
84
- kwargs['paginationToken'] = pagination_token
85
- return self._request(kwargs.pop('path'), data=kwargs, add_marketplace=False)
85
+ kwargs["paginationToken"] = pagination_token
86
+ return self._request(kwargs.pop("path"), data=kwargs, add_marketplace=False)
86
87
 
87
- @sp_endpoint('/dataKiosk/2023-11-15/queries/{}', method='DELETE')
88
+ @sp_endpoint("/dataKiosk/2023-11-15/queries/{}", method="DELETE")
88
89
  def cancel_query(self, query_id, **kwargs) -> ApiResponse:
89
90
  """
90
91
  cancel_query(self, queryId, **kwargs) -> ApiResponse
@@ -102,17 +103,21 @@ class DataKiosk(Client):
102
103
  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).
103
104
 
104
105
  Args:
105
-
106
+
106
107
  query_id:string | * REQUIRED The identifier for the query. This identifier is unique only in combination with a selling partner account ID.
107
-
108
+
108
109
 
109
110
  Returns:
110
111
  ApiResponse:
111
112
  """
112
113
 
113
- return self._request(fill_query_params(kwargs.pop('path'), query_id), data=kwargs, add_marketplace=False)
114
+ return self._request(
115
+ fill_query_params(kwargs.pop("path"), query_id),
116
+ data=kwargs,
117
+ add_marketplace=False,
118
+ )
114
119
 
115
- @sp_endpoint('/dataKiosk/2023-11-15/queries/{}', method='GET')
120
+ @sp_endpoint("/dataKiosk/2023-11-15/queries/{}", method="GET")
116
121
  def get_query(self, query_id, **kwargs) -> ApiResponse:
117
122
  """
118
123
  get_query(self, queryId, **kwargs) -> ApiResponse
@@ -130,19 +135,29 @@ class DataKiosk(Client):
130
135
  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).
131
136
 
132
137
  Args:
133
-
138
+
134
139
  query_id:string | * REQUIRED The query identifier.
135
-
140
+
136
141
 
137
142
  Returns:
138
143
  ApiResponse:
139
144
  """
140
145
 
141
- return self._request(fill_query_params(kwargs.pop('path'), query_id), params=kwargs, add_marketplace=False)
142
-
143
- @sp_endpoint('/dataKiosk/2023-11-15/documents/{}', method='GET')
144
- def get_document(self, document_id, download: bool = False, file: Union[BytesIO, str, BinaryIO, TextIO] = None,
145
- encoding='utf-8', **kwargs) -> ApiResponse:
146
+ return self._request(
147
+ fill_query_params(kwargs.pop("path"), query_id),
148
+ params=kwargs,
149
+ add_marketplace=False,
150
+ )
151
+
152
+ @sp_endpoint("/dataKiosk/2023-11-15/documents/{}", method="GET")
153
+ def get_document(
154
+ self,
155
+ document_id,
156
+ download: bool = False,
157
+ file: Union[BytesIO, str, BinaryIO, TextIO] = None,
158
+ encoding="utf-8",
159
+ **kwargs
160
+ ) -> ApiResponse:
146
161
  """
147
162
  get_document(self, document_id, download: bool = False, file: Union[BytesIO, str, BinaryIO, TextIO] = None, encoding='utf-8', **kwargs) -> ApiResponse
148
163
 
@@ -159,7 +174,7 @@ class DataKiosk(Client):
159
174
  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).
160
175
 
161
176
  Args:
162
-
177
+
163
178
  document_id:string | * REQUIRED The identifier for the Data Kiosk document.
164
179
  file: | * OPTIONAL The file to write the response to.
165
180
  download: | * OPTIONAL If True, the file will be downloaded and returned in the payload.
@@ -170,25 +185,30 @@ class DataKiosk(Client):
170
185
  ApiResponse:
171
186
  """
172
187
 
173
- res = self._request(fill_query_params(kwargs.pop('path'), document_id), params=kwargs, add_marketplace=False)
174
- if download or file or ('decrypt' in kwargs and kwargs['decrypt']):
175
- import requests
176
- document_response = requests.get(
177
- res.payload.get('documentUrl'),
188
+ res = self._request(
189
+ fill_query_params(kwargs.pop("path"), document_id),
190
+ params=kwargs,
191
+ add_marketplace=False,
192
+ )
193
+ if download or file or ("decrypt" in kwargs and kwargs["decrypt"]):
194
+ with httpx.Client(
178
195
  proxies=self.proxies,
179
196
  verify=self.verify,
180
- )
181
- document = document_response.content
197
+ ) as client:
198
+ document_response = client.get(res.payload.get("documentUrl"))
199
+ document = document_response.content
182
200
  if download:
183
- res.payload.update({
184
- 'document': document,
185
- })
201
+ res.payload.update(
202
+ {
203
+ "document": document,
204
+ }
205
+ )
186
206
  if file:
187
207
  self._handle_file(file, document, encoding=encoding)
188
208
  return res
189
209
 
190
210
  @staticmethod
191
- def _handle_file(file, document, encoding='utf-8'):
211
+ def _handle_file(file, document, encoding="utf-8"):
192
212
  if isinstance(file, str):
193
213
  if isinstance(document, bytes):
194
214
  with open(file, "wb+") as f:
@@ -203,7 +223,7 @@ class DataKiosk(Client):
203
223
  file.write(document.decode(encoding))
204
224
  file.seek(0)
205
225
  else:
206
- if 'b' in file.mode:
226
+ if "b" in file.mode:
207
227
  file.write(document)
208
228
  else:
209
229
  file.write(document.decode(encoding))
@@ -0,0 +1,190 @@
1
+ import urllib.parse
2
+
3
+ from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
4
+
5
+
6
+ class EasyShip(Client):
7
+ """
8
+ Easy_ SP-API Client
9
+ :link:
10
+
11
+ Use the Selling Partner API for Easy Ship to build applications for sellers to manage and ship Amazon Easy Ship orders. With this API, you can get available time slots, schedule and reschedule Easy Ship orders, and print shipping labels, invoices, and warranties. To review the differences in Easy Ship operations by marketplace, refer to [Marketplace support](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support).
12
+ """
13
+
14
+
15
+ @sp_endpoint('/easyShip/2022-03-23/timeSlot', method='POST')
16
+ def list_handover_slots(self, **kwargs) -> ApiResponse:
17
+ """
18
+ list_handover_slots(self, **kwargs) -> ApiResponse
19
+
20
+ Returns time slots available for Easy Ship orders to be scheduled based on the package weight and dimensions that the seller specifies.
21
+
22
+ This operation is available for scheduled and unscheduled orders based on marketplace support. See **Get Time Slots** in the [Marketplace Support Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table).
23
+
24
+ This operation can return time slots that have either pickup or drop-off handover methods - see **Supported Handover Methods** in the [Marketplace Support Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table).
25
+
26
+ **Usage Plan:**
27
+
28
+ | Rate (requests per second) | Burst |
29
+ | ---- | ---- |
30
+ | 1 | 5 |
31
+
32
+ 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, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
33
+
34
+ Args:
35
+
36
+ ListHandoverSlotsRequest: | {'description': 'The request schema for the `listHandoverSlots` operation.',
37
+ 'properties': {'amazonOrderId': {'$ref': '#/definitions/AmazonOrderId'}, 'marketplaceId': {'$ref': '#/definitions/String'}, 'packageDimensions': {'$ref': '#/definitions/Dimensions'}, 'packageWeight': {'$ref': '#/definitions/Weight'}},
38
+ 'required': ['marketplaceId', 'amazonOrderId', 'packageDimensions', 'packageWeight'],
39
+ 'type': 'object'}
40
+
41
+
42
+ Returns:
43
+ ApiResponse:
44
+ """
45
+
46
+ return self._request(kwargs.pop('path'), data=kwargs)
47
+
48
+
49
+ @sp_endpoint('/easyShip/2022-03-23/package', method='GET')
50
+ def get_scheduled_package(self, **kwargs) -> ApiResponse:
51
+ """
52
+ get_scheduled_package(self, **kwargs) -> ApiResponse
53
+
54
+ Returns information about a package, including dimensions, weight, time slot information for handover, invoice and item information, and status.
55
+
56
+ **Usage Plan:**
57
+
58
+ | Rate (requests per second) | Burst |
59
+ | ---- | ---- |
60
+ | 1 | 5 |
61
+
62
+ 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, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
63
+
64
+ Args:
65
+
66
+ key amazonOrderId:string | * REQUIRED An Amazon-defined order identifier. Identifies the order that the seller wants to deliver using Amazon Easy Ship.
67
+
68
+ key marketplaceId:string | * REQUIRED An identifier for the marketplace in which the seller is selling.
69
+
70
+
71
+ Returns:
72
+ ApiResponse:
73
+ """
74
+
75
+ return self._request(kwargs.pop('path'), params=kwargs)
76
+
77
+
78
+ @sp_endpoint('/easyShip/2022-03-23/package', method='POST')
79
+ def create_scheduled_package(self, **kwargs) -> ApiResponse:
80
+ """
81
+ create_scheduled_package(self, **kwargs) -> ApiResponse
82
+
83
+ Schedules an Easy Ship order and returns the scheduled package information.
84
+
85
+ This operation does the following:
86
+
87
+ * Specifies the time slot and handover method for the order to be scheduled for delivery.
88
+
89
+ * Updates the Easy Ship order status.
90
+
91
+ * Generates a shipping label and an invoice. Calling `createScheduledPackage` also generates a warranty document if you specify a `SerialNumber` value. To get these documents, see [How to get invoice, shipping label, and warranty documents](doc:easyship-api-v2022-03-23-use-case-guide).
92
+
93
+ * Shows the status of Easy Ship orders when you call the `getOrders` operation of the Selling Partner API for Orders and examine the `EasyShipShipmentStatus` property in the response body.
94
+
95
+ See the **Shipping Label**, **Invoice**, and **Warranty** columns in the [Marketplace Support Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table) to see which documents are supported in each marketplace.
96
+
97
+ **Usage Plan:**
98
+
99
+ | Rate (requests per second) | Burst |
100
+ | ---- | ---- |
101
+ | 1 | 5 |
102
+
103
+ 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, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
104
+
105
+ Args:
106
+
107
+ CreateScheduledPackageRequest: | * REQUIRED {'description': 'The request schema for the `createScheduledPackage` operation.',
108
+ 'properties': {'amazonOrderId': {'$ref': '#/definitions/AmazonOrderId'}, 'marketplaceId': {'$ref': '#/definitions/String'}, 'packageDetails': {'$ref': '#/definitions/PackageDetails'}},
109
+ 'required': ['amazonOrderId', 'marketplaceId', 'packageDetails'],
110
+ 'type': 'object'}
111
+
112
+
113
+ Returns:
114
+ ApiResponse:
115
+ """
116
+
117
+ return self._request(kwargs.pop('path'), data=kwargs)
118
+
119
+
120
+ @sp_endpoint('/easyShip/2022-03-23/package', method='PATCH')
121
+ def update_scheduled_packages(self, **kwargs) -> ApiResponse:
122
+ """
123
+ update_scheduled_packages(self, **kwargs) -> ApiResponse
124
+
125
+ Updates the time slot for handing over the package indicated by the specified `scheduledPackageId`. You can get the new `slotId` value for the time slot by calling the `listHandoverSlots` operation before making another `patch` call.
126
+
127
+ See the **Update Package** column in the [Marketplace Support Table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table) to see which marketplaces this operation is supported in.
128
+
129
+ **Usage Plan:**
130
+
131
+ | Rate (requests per second) | Burst |
132
+ | ---- | ---- |
133
+ | 1 | 5 |
134
+
135
+ 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, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
136
+
137
+ Args:
138
+
139
+ UpdateScheduledPackagesRequest: | {'description': 'The request schema for the `updateScheduledPackages` operation.',
140
+ 'properties': {'marketplaceId': {'$ref': '#/definitions/String'}, 'updatePackageDetailsList': {'$ref': '#/definitions/UpdatePackageDetailsList'}},
141
+ 'required': ['marketplaceId', 'updatePackageDetailsList'],
142
+ 'type': 'object'}
143
+
144
+
145
+ Returns:
146
+ ApiResponse:
147
+ """
148
+
149
+ return self._request(kwargs.pop('path'), data=kwargs)
150
+
151
+
152
+ @sp_endpoint('/easyShip/2022-03-23/packages/bulk', method='POST')
153
+ def create_scheduled_package_bulk(self, **kwargs) -> ApiResponse:
154
+ """
155
+ create_scheduled_package_bulk(self, **kwargs) -> ApiResponse
156
+
157
+ This operation automatically schedules a time slot for all the `amazonOrderId`s given as input, generating the associated shipping labels, along with other compliance documents according to the marketplace (refer to the [marketplace document support table](doc:easyship-api-v2022-03-23-use-case-guide#marketplace-support-table)).
158
+
159
+ Developers calling this operation may optionally assign a `packageDetails` object, allowing them to input a preferred time slot for each order in their request. In this case, Amazon will try to schedule the respective packages using their optional settings. On the other hand, *i.e.*, if the time slot is not provided, Amazon will then pick the earliest time slot possible.
160
+
161
+ Regarding the shipping label's file format, external developers are able to choose between PDF or ZPL, and Amazon will create the label accordingly.
162
+
163
+ This operation returns an array composed of the scheduled packages, and a short-lived URL pointing to a zip file containing the generated shipping labels and the other documents enabled for your marketplace. If at least an order couldn't be scheduled, then Amazon adds the `rejectedOrders` list into the response, which contains an entry for each order we couldn't process. Each entry is composed of an error message describing the reason of the failure, so that sellers can take action.
164
+
165
+ The table below displays the supported request and burst maximum rates:
166
+
167
+ **Usage Plan:**
168
+
169
+ | Rate (requests per second) | Burst |
170
+ | ---- | ---- |
171
+ | 1 | 5 |
172
+
173
+ 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, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
174
+
175
+ Args:
176
+
177
+ CreateScheduledPackagesRequest: | * REQUIRED {'description': 'The request body for the POST /easyShip/2022-03-23/packages/bulk API.',
178
+ 'properties': {'labelFormat': {'$ref': '#/definitions/LabelFormat'},
179
+ 'marketplaceId': {'$ref': '#/definitions/String'},
180
+ 'orderScheduleDetailsList': {'description': 'An array allowing users to specify orders to be scheduled.', 'items': {'$ref': '#/definitions/OrderScheduleDetails'}, 'minItems': 1, 'type': 'array'}},
181
+ 'required': ['marketplaceId', 'orderScheduleDetailsList', 'labelFormat'],
182
+ 'type': 'object'}
183
+
184
+
185
+ Returns:
186
+ ApiResponse:
187
+ """
188
+
189
+ return self._request(kwargs.pop('path'), data=kwargs)
190
+