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
@@ -0,0 +1,295 @@
1
+ from sp_api.base.helpers import sp_endpoint, fill_query_params
2
+ from sp_api.base import Client, Marketplaces, deprecated, NotificationType, ApiResponse
3
+ from sp_api.asyncio.base import AsyncBaseClient
4
+
5
+
6
+ class Notifications(AsyncBaseClient):
7
+ """
8
+ :link: https://github.com/amzn/selling-partner-api-docs/blob/main/references/notifications-api/notifications.md
9
+ """
10
+
11
+ grantless_scope = "sellingpartnerapi::notifications"
12
+
13
+ @deprecated
14
+ async def add_subscription(self, notification_type: NotificationType or str, **kwargs):
15
+ """deprecated, use create_subscription"""
16
+ return self.create_subscription(notification_type, **kwargs)
17
+
18
+ @sp_endpoint("/notifications/v1/subscriptions/{}", method="POST")
19
+ async def create_subscription(
20
+ self,
21
+ notification_type: NotificationType or str,
22
+ destination_id: str = None,
23
+ **kwargs
24
+ ) -> ApiResponse:
25
+ """
26
+ create_subscription(self, notification_type: NotificationType or str, destination_id: str = None, **kwargs) -> ApiResponse
27
+ Creates a subscription for the specified notification type to be delivered to the specified destination.
28
+ Before you can subscribe, you must first create the destination by calling the createDestination operation.
29
+
30
+ **Usage Plan:**
31
+
32
+ ====================================== ==============
33
+ Rate (requests per second) Burst
34
+ ====================================== ==============
35
+ 1 5
36
+ ====================================== ==============
37
+
38
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
39
+
40
+ Examples:
41
+ literal blocks::
42
+
43
+ Notifications().create_subscription(NotificationType.MFN_ORDER_STATUS_CHANGE, destination_id='dest_id')
44
+
45
+ Args:
46
+ notification_type: NotificationType or str
47
+ destination_id: str
48
+ **kwargs:
49
+
50
+
51
+ Returns:
52
+ ApiResponse:
53
+
54
+ """
55
+ data = {
56
+ "destinationId": kwargs.pop("destinationId", destination_id),
57
+ "payloadVersion": kwargs.pop("payload_version", "1.0"),
58
+ }
59
+ return await self._request(
60
+ fill_query_params(
61
+ kwargs.pop("path"),
62
+ (
63
+ notification_type
64
+ if isinstance(notification_type, str)
65
+ else notification_type.value
66
+ ),
67
+ ),
68
+ data={**kwargs, **data},
69
+ )
70
+
71
+ @sp_endpoint("/notifications/v1/subscriptions/{}")
72
+ async def get_subscription(
73
+ self, notification_type: NotificationType or str, **kwargs
74
+ ) -> ApiResponse:
75
+ """
76
+ get_subscription(self, notification_type: NotificationType or str, **kwargs) -> ApiResponse
77
+ Returns information about subscriptions of the specified notification type. You can use this API to get subscription information when you do not have a subscription identifier.
78
+
79
+ **Usage Plan:**
80
+
81
+ ====================================== ==============
82
+ Rate (requests per second) Burst
83
+ ====================================== ==============
84
+ 1 5
85
+ ====================================== ==============
86
+
87
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
88
+
89
+ Examples:
90
+ literal blocks::
91
+
92
+ Notifications().get_subscription(NotificationType.REPORT_PROCESSING_FINISHED)
93
+
94
+ Args:
95
+ notification_type: NotificationType or str
96
+ **kwargs:
97
+
98
+ Returns:
99
+ ApiResponse:
100
+
101
+ """
102
+ return await self._request(
103
+ fill_query_params(
104
+ kwargs.pop("path"),
105
+ (
106
+ notification_type
107
+ if isinstance(notification_type, str)
108
+ else notification_type.value
109
+ ),
110
+ ),
111
+ params={**kwargs},
112
+ )
113
+
114
+ @sp_endpoint("/notifications/v1/subscriptions/{}/{}", method="DELETE")
115
+ async def delete_notification_subscription(
116
+ self, notification_type: NotificationType or str, subscription_id: str, **kwargs
117
+ ) -> ApiResponse:
118
+ """
119
+ delete_notification_subscription(self, notification_type: NotificationType or str, subscription_id: str, **kwargs) -> ApiResponse
120
+ Deletes the subscription indicated by the subscription identifier and notification type that you specify.
121
+ The subscription identifier can be for any subscription associated with your application. After you successfully call this operation, notifications will stop being sent for the associated subscription. The deleteSubscriptionById API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
122
+
123
+ **Usage Plan:**
124
+
125
+ ====================================== ==============
126
+ Rate (requests per second) Burst
127
+ ====================================== ==============
128
+ 1 5
129
+ ====================================== ==============
130
+
131
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
132
+
133
+ Examples:
134
+ Notifications().delete_notification_subscription(NotificationType.MFN_ORDER_STATUS_CHANGE, 'subscription_id')
135
+
136
+ Args:
137
+ notification_type: NotificationType or str
138
+ subscription_id: str
139
+ **kwargs:
140
+
141
+ Returns:
142
+ ApiResponse:
143
+
144
+ """
145
+ return await self._request(
146
+ fill_query_params(
147
+ kwargs.pop("path"),
148
+ (
149
+ notification_type
150
+ if isinstance(notification_type, str)
151
+ else notification_type.value
152
+ ),
153
+ subscription_id,
154
+ ),
155
+ params={**kwargs},
156
+ )
157
+
158
+ @sp_endpoint(path="/notifications/v1/destinations", method="POST")
159
+ async def create_destination(
160
+ self,
161
+ name: str,
162
+ arn: str = None,
163
+ account_id: str = None,
164
+ region: str = None,
165
+ **kwargs
166
+ ) -> ApiResponse:
167
+ """
168
+ create_destination(self, name: str, arn: str, **kwargs) -> ApiResponse
169
+ Creates a destination resource to receive notifications. The createDestination API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
170
+
171
+ **Usage Plan:**
172
+
173
+ ====================================== ==============
174
+ Rate (requests per second) Burst
175
+ ====================================== ==============
176
+ 1 5
177
+ ====================================== ==============
178
+
179
+ Examples:
180
+ literal blocks::
181
+
182
+ Notifications().create_destination(name='test', arn='arn:aws:sqs:us-east-2:444455556666:queue1')
183
+
184
+ Args:
185
+ account_id:
186
+ region:
187
+ name: str
188
+ arn: str
189
+ **kwargs:
190
+
191
+ Returns:
192
+ ApiResponse:
193
+
194
+ """
195
+ resource_name = "sqs" if not account_id else "eventBridge"
196
+ region = region if region else self.region
197
+
198
+ data = {
199
+ "resourceSpecification": {
200
+ resource_name: (
201
+ {"arn": arn}
202
+ if not account_id
203
+ else {"region": region, "accountId": account_id}
204
+ )
205
+ },
206
+ "name": name,
207
+ }
208
+
209
+ return await self._request_grantless_operation(
210
+ kwargs.pop("path"), data={**kwargs, **data}
211
+ )
212
+
213
+ @sp_endpoint("/notifications/v1/destinations", method="GET")
214
+ async def get_destinations(self, **kwargs) -> ApiResponse:
215
+ """
216
+ get_destinations(self, **kwargs) -> ApiResponse
217
+ Returns information about all destinations. The getDestinations API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
218
+
219
+ **Usage Plan:**
220
+
221
+ ====================================== ==============
222
+ Rate (requests per second) Burst
223
+ ====================================== ==============
224
+ 1 5
225
+ ====================================== ==============
226
+
227
+
228
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
229
+
230
+ Args:
231
+ **kwargs:
232
+
233
+ Returns:
234
+ ApiResponse:
235
+
236
+ """
237
+ return await self._request_grantless_operation(kwargs.pop("path"), params={**kwargs})
238
+
239
+ @sp_endpoint("/notifications/v1/destinations/{}", method="GET")
240
+ async def get_destination(self, destination_id: str, **kwargs) -> ApiResponse:
241
+ """
242
+ get_destination(self, destination_id: str, **kwargs) -> ApiResponse
243
+ Returns information about all destinations. The getDestinations API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
244
+
245
+ **Usage Plan:**
246
+
247
+ ====================================== ==============
248
+ Rate (requests per second) Burst
249
+ ====================================== ==============
250
+ 1 5
251
+ ====================================== ==============
252
+
253
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
254
+
255
+
256
+ Args:
257
+ destination_id: str
258
+ **kwargs:
259
+
260
+ Returns:
261
+ ApiResponse:
262
+
263
+
264
+ """
265
+ return await self._request_grantless_operation(
266
+ fill_query_params(kwargs.pop("path"), destination_id), params={**kwargs}
267
+ )
268
+
269
+ @sp_endpoint("/notifications/v1/destinations/{}", method="DELETE")
270
+ async def delete_destination(self, destination_id: str, **kwargs) -> ApiResponse:
271
+ """
272
+ delete_destination(self, destination_id: str, **kwargs) -> ApiResponse
273
+ Deletes the destination that you specify. The deleteDestination API is grantless. For more information, see "Grantless operations" in the Selling Partner API Developer Guide.
274
+
275
+ **Usage Plan:**
276
+
277
+ ====================================== ==============
278
+ Rate (requests per second) Burst
279
+ ====================================== ==============
280
+ 1 5
281
+ ====================================== ==============
282
+
283
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
284
+
285
+ Args:
286
+ destination_id: str
287
+ **kwargs:
288
+
289
+ Returns:
290
+ ApiResponse:
291
+
292
+ """
293
+ return await self._request_grantless_operation(
294
+ fill_query_params(kwargs.pop("path"), destination_id), params={**kwargs}
295
+ )
File without changes
@@ -0,0 +1,356 @@
1
+ from sp_api.base import sp_endpoint, fill_query_params, ApiResponse, deprecated
2
+ from sp_api.asyncio.base import AsyncBaseClient
3
+ from sp_api.base import Client, Marketplaces
4
+
5
+
6
+ class Orders(AsyncBaseClient):
7
+ """
8
+ :link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api
9
+ """
10
+
11
+ @sp_endpoint("/orders/v0/orders")
12
+ async def get_orders(self, **kwargs) -> ApiResponse:
13
+ """
14
+ get_orders(self, **kwargs) -> ApiResponse
15
+ Returns orders created or updated during the time frame indicated by the specified parameters.
16
+ You can also apply a range of filtering criteria to narrow the list of orders returned.
17
+ If NextToken is present, that will be used to retrieve the orders instead of other criteria.
18
+
19
+ **Usage Plan:**
20
+
21
+ ====================================== ==============
22
+ Rate (requests per second) Burst
23
+ ====================================== ==============
24
+ 1 1
25
+ ====================================== ==============
26
+
27
+
28
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
29
+
30
+ Examples:
31
+ literal blocks::
32
+
33
+ Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
34
+
35
+ Args:
36
+ key CreatedAfter: date
37
+ key CreatedBefore: date
38
+ key LastUpdatedAfter: date
39
+ key LastUpdatedBefore: date
40
+ key OrderStatuses: [str]
41
+ key MarketplaceIds: [str]
42
+ key FulfillmentChannels: [str]
43
+ key PaymentMethods: [str]
44
+ key BuyerEmail: str
45
+ key SellerOrderId: str
46
+ key MaxResultsPerPage: int
47
+ key EasyShipShipmentStatuses: [str]
48
+ key NextToken: str
49
+ key AmazonOrderIds: [str]
50
+ key RestrictedResources: [str]
51
+
52
+ Returns:
53
+ ApiResponse:
54
+
55
+
56
+ """
57
+ if "RestrictedResources" in kwargs:
58
+ return self._access_restricted(kwargs)
59
+ return await self._request(kwargs.pop("path"), params={**kwargs})
60
+
61
+ @sp_endpoint("/orders/v0/orders/{}")
62
+ async def get_order(self, order_id: str, **kwargs) -> ApiResponse:
63
+ """
64
+ get_order(self, order_id: str, **kwargs) -> ApiResponse
65
+ Returns the order indicated by the specified order ID.
66
+
67
+ **Usage Plan:**
68
+
69
+ ====================================== ==============
70
+ Rate (requests per second) Burst
71
+ ====================================== ==============
72
+ 1 1
73
+ ====================================== ==============
74
+
75
+
76
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
77
+
78
+ Examples:
79
+ literal blocks::
80
+
81
+ Orders().get_order('TEST_CASE_200')
82
+
83
+ Args:
84
+ order_id: str
85
+ key RestrictedResources: [str]
86
+ **kwargs:
87
+
88
+ Returns:
89
+ ApiResponse:
90
+
91
+
92
+ """
93
+ if "RestrictedResources" in kwargs:
94
+ kwargs.update(
95
+ {"original_path": fill_query_params(kwargs.get("path"), order_id)}
96
+ )
97
+ return self._access_restricted(kwargs)
98
+ return await self._request(
99
+ fill_query_params(kwargs.pop("path"), order_id),
100
+ params={**kwargs},
101
+ add_marketplace=False,
102
+ )
103
+
104
+ @sp_endpoint("/orders/v0/orders/{}/orderItems")
105
+ async def get_order_items(self, order_id: str, **kwargs) -> ApiResponse:
106
+ """
107
+ get_order_items(self, order_id: str, **kwargs) -> ApiResponse
108
+
109
+ Returns detailed order item information for the order indicated by the specified order ID.
110
+ If NextToken is provided, it's used to retrieve the next page of order items.
111
+
112
+ Note: When an order is in the Pending state (the order has been placed but payment has not been authorized),
113
+ the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or
114
+ promotions for the order items in the order.
115
+ After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped,
116
+ Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes,
117
+ shipping charges, gift status and promotions for the order items in the order.
118
+
119
+
120
+ **Usage Plan:**
121
+
122
+ ====================================== ==============
123
+ Rate (requests per second) Burst
124
+ ====================================== ==============
125
+ 1 1
126
+ ====================================== ==============
127
+
128
+
129
+
130
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
131
+
132
+ Examples:
133
+ literal blocks::
134
+
135
+ Orders().get_order_items('TEST_CASE_200')
136
+
137
+ Args:
138
+ order_id: str
139
+ key RestrictedResources: [str]
140
+ **kwargs:
141
+
142
+ Returns:
143
+ ApiResponse:
144
+
145
+ """
146
+ if "RestrictedResources" in kwargs:
147
+ kwargs.update(
148
+ {"original_path": fill_query_params(kwargs.get("path"), order_id)}
149
+ )
150
+ return self._access_restricted(kwargs)
151
+ return await self._request(
152
+ fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
153
+ )
154
+
155
+ @sp_endpoint("/orders/v0/orders/{}/address")
156
+ async def get_order_address(self, order_id, **kwargs) -> ApiResponse:
157
+ """
158
+ get_order_address(self, order_id, **kwargs) -> ApiResponse
159
+
160
+ Returns the shipping address for the order indicated by the specified order ID.
161
+
162
+ :note: To get useful information from this method, you need to have access to PII.
163
+
164
+ **Usage Plan:**
165
+
166
+ ====================================== ==============
167
+ Rate (requests per second) Burst
168
+ ====================================== ==============
169
+ 1 1
170
+ ====================================== ==============
171
+
172
+ Examples:
173
+ Orders().get_order_address('TEST_CASE_200')
174
+
175
+ Args:
176
+ order_id: str
177
+ **kwargs:
178
+
179
+ Returns:
180
+ ApiResponse
181
+ """
182
+ return await self._request(
183
+ fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
184
+ )
185
+
186
+ @sp_endpoint("/orders/v0/orders/{}/buyerInfo")
187
+ async def get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
188
+ """
189
+ get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
190
+ Returns buyer information for the order indicated by the specified order ID.
191
+
192
+ :note: To get useful information from this method, you need to have access to PII.
193
+
194
+
195
+ **Usage Plan:**
196
+
197
+ ====================================== ==============
198
+ Rate (requests per second) Burst
199
+ ====================================== ==============
200
+ 1 1
201
+ ====================================== ==============
202
+
203
+
204
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
205
+
206
+ Examples:
207
+ Orders().get_order_buyer_info('TEST_CASE_200')
208
+
209
+ Args:
210
+ order_id: str
211
+ **kwargs:
212
+
213
+ Returns:
214
+ GetOrderBuyerInfoResponse:
215
+
216
+ """
217
+ return await self._request(
218
+ fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
219
+ )
220
+
221
+ @sp_endpoint("/orders/v0/orders/{}/orderItems/buyerInfo")
222
+ async def get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
223
+ """
224
+ get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
225
+
226
+ Returns buyer information in the order items of the order indicated by the specified order ID.
227
+
228
+ **Usage Plan:**
229
+
230
+ ====================================== ==============
231
+ Rate (requests per second) Burst
232
+ ====================================== ==============
233
+ 1 1
234
+ ====================================== ==============
235
+
236
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
237
+
238
+ Examples:
239
+ literal blocks::
240
+
241
+ Orders().get_order_items_buyer_info('TEST_CASE_200')
242
+
243
+ Args:
244
+ order_id: str
245
+ key NextToken: str | retrieve data by next token
246
+
247
+ Returns:
248
+ ApiResponse
249
+ """
250
+ return await self._request(
251
+ fill_query_params(kwargs.pop("path"), order_id), params=kwargs
252
+ )
253
+
254
+ @sp_endpoint("/orders/v0/orders/{}/shipment", method="POST")
255
+ async def update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse:
256
+ """
257
+ update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse
258
+ Update the shipment status.
259
+ **Usage Plan:**
260
+ ====================================== ==============
261
+ Rate (requests per second) Burst
262
+ ====================================== ==============
263
+ 5 15
264
+ ====================================== ==============
265
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
266
+ Examples:
267
+ literal blocks::
268
+ Orders().update_shipment_status(
269
+ order_id='123-1234567-1234567',
270
+ marketplaceId='ATVPDKIKX0DER',
271
+ shipmentStatus='ReadyForPickup'
272
+ )
273
+ Args:
274
+ order_id: str
275
+ Returns:
276
+ ApiResponse
277
+ """
278
+ return await self._request(
279
+ fill_query_params(kwargs.pop("path"), order_id),
280
+ res_no_data=True,
281
+ data=kwargs,
282
+ )
283
+
284
+ @sp_endpoint("/orders/v0/orders/{}/shipmentConfirmation", method="POST")
285
+ async def confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse:
286
+ """
287
+ confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse
288
+ Updates the shipment confirmation status for a specified order.
289
+ **Usage Plan:**
290
+ ====================================== ==============
291
+ Rate (requests per second) Burst
292
+ ====================================== ==============
293
+ 2 10
294
+ ====================================== ==============
295
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
296
+ Examples:
297
+ literal blocks::
298
+ Orders().confirm_shipment(
299
+ order_id='123-1234567-1234567',
300
+ marketplaceId='ATVPDKIKX0DER',
301
+ packageDetail={
302
+ 'packageReferenceId': '0001',
303
+ 'carrierCode': 'DHL',
304
+ "shippingMethod": 'Paket',
305
+ 'trackingNumber': '1234567890',
306
+ 'shipDate': '2023-03-19T12:00:00Z',
307
+ 'orderItems': [
308
+ {
309
+ 'orderItemId': '123456789',
310
+ 'quantity': 1
311
+ },
312
+ {
313
+ 'orderItemId': '2345678901',
314
+ 'quantity': 2
315
+ },
316
+ ]
317
+ }
318
+ )
319
+ Args:
320
+ order_id: str
321
+ Returns:
322
+ ApiResponse
323
+ """
324
+ return await self._request(
325
+ fill_query_params(kwargs.pop("path"), order_id),
326
+ add_marketplace=False,
327
+ res_no_data=True,
328
+ data=kwargs,
329
+ )
330
+
331
+ @sp_endpoint("/tokens/2021-03-01/restrictedDataToken", method="POST")
332
+ async def _get_token(self, **kwargs):
333
+ data_elements = kwargs.pop("RestrictedResources")
334
+
335
+ restricted_resources = [
336
+ {
337
+ "method": "GET",
338
+ "path": kwargs.get("original_path"),
339
+ "dataElements": data_elements,
340
+ }
341
+ ]
342
+
343
+ return await self._request(
344
+ kwargs.pop("path"),
345
+ data={"restrictedResources": restricted_resources, **kwargs},
346
+ )
347
+
348
+ async def _access_restricted(self, kwargs):
349
+ if "original_path" not in kwargs:
350
+ kwargs.update({"original_path": kwargs["path"]})
351
+ token = self._get_token(**kwargs).payload
352
+ self.restricted_data_token = token["restrictedDataToken"]
353
+ r = await self._request(kwargs.pop("original_path"), params={**kwargs})
354
+ if not self.keep_restricted_data_token:
355
+ self.restricted_data_token = None
356
+ return r
@@ -0,0 +1 @@
1
+
File without changes