python-amazon-sp-api 2.0.15__py3-none-any.whl → 2.1.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 (214) hide show
  1. {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/METADATA +7 -7
  2. python_amazon_sp_api-2.1.3.dist-info/RECORD +350 -0
  3. sp_api/__version__.py +1 -1
  4. sp_api/api/__init__.py +160 -4
  5. sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +85 -110
  6. sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu_2024_05_09.py +456 -0
  7. sp_api/api/aplus_content/aplus_content.py +176 -125
  8. sp_api/api/application_integrations/application_integrations.py +59 -68
  9. sp_api/api/application_management/application_management.py +20 -13
  10. sp_api/api/authorization/authorization.py +8 -26
  11. sp_api/api/catalog/catalog.py +27 -61
  12. sp_api/api/catalog_items/catalog_items.py +108 -78
  13. sp_api/api/catalog_items/catalog_items_2020_12_01.py +86 -0
  14. sp_api/api/catalog_items/catalog_items_2022_04_01.py +89 -0
  15. sp_api/api/customer_feedback/customer_feedback.py +100 -0
  16. sp_api/api/data_kiosk/data_kiosk.py +80 -75
  17. sp_api/api/delivery_by_amazon/__init__.py +0 -0
  18. sp_api/api/delivery_by_amazon/delivery_by_amazon.py +92 -0
  19. sp_api/api/delivery_by_amazon/delivery_by_amazon_2022_07_01.py +81 -0
  20. sp_api/api/easy_ship/easy_ship.py +121 -111
  21. sp_api/api/external_fulfillment/external_fulfillment.py +211 -434
  22. sp_api/api/external_fulfillment/inventory.py +120 -0
  23. sp_api/api/external_fulfillment/inventory_2021_01_06.py +71 -0
  24. sp_api/api/external_fulfillment/inventory_2024_09_11.py +96 -0
  25. sp_api/api/external_fulfillment/returns.py +120 -0
  26. sp_api/api/external_fulfillment/returns_2021_08_19.py +88 -0
  27. sp_api/api/external_fulfillment/returns_2024_09_11.py +141 -0
  28. sp_api/api/external_fulfillment/shipping.py +120 -0
  29. sp_api/api/external_fulfillment/shipping_2021_01_06.py +256 -0
  30. sp_api/api/external_fulfillment/shipping_2024_09_11.py +233 -0
  31. sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py +30 -24
  32. sp_api/api/fba_small_and_light/fba_small_and_light.py +60 -99
  33. sp_api/api/feeds/feeds.py +75 -245
  34. sp_api/api/feeds/feeds_2021_06_30.py +320 -0
  35. sp_api/api/finances/finances.py +123 -90
  36. sp_api/api/finances/finances_2024_06_01.py +71 -0
  37. sp_api/api/finances/finances_2024_06_19.py +114 -0
  38. sp_api/api/finances/finances_v0.py +116 -0
  39. sp_api/api/fulfillment_inbound/fulfillment_inbound.py +107 -1784
  40. sp_api/api/fulfillment_inbound/fulfillment_inbound_2024_03_20.py +1722 -0
  41. sp_api/api/fulfillment_inbound/fulfillment_inbound_v0.py +1384 -0
  42. sp_api/api/fulfillment_outbound/fulfillment_outbound.py +256 -480
  43. sp_api/api/inventories/inventories.py +79 -42
  44. sp_api/api/invoices/__init__.py +0 -0
  45. sp_api/api/invoices/invoices.py +92 -0
  46. sp_api/api/invoices/invoices_2024_06_19.py +344 -0
  47. sp_api/api/listings_items/listings_items.py +110 -163
  48. sp_api/api/listings_items/listings_items_2020_09_01.py +189 -0
  49. sp_api/api/listings_items/listings_items_2021_08_01.py +233 -0
  50. sp_api/api/listings_restrictions/listings_restrictions.py +23 -10
  51. sp_api/api/merchant_fulfillment/merchant_fulfillment.py +107 -222
  52. sp_api/api/messaging/messaging.py +184 -198
  53. sp_api/api/notifications/notifications.py +144 -106
  54. sp_api/api/orders/orders.py +9 -46
  55. sp_api/api/orders/orders_2026_01_01.py +19 -65
  56. sp_api/api/orders/orders_v0.py +152 -184
  57. sp_api/api/product_fees/product_fees.py +101 -75
  58. sp_api/api/product_type_definitions/product_type_definitions.py +47 -36
  59. sp_api/api/products/products.py +94 -386
  60. sp_api/api/products/products_2022_05_01.py +96 -0
  61. sp_api/api/products/products_v0.py +389 -0
  62. sp_api/api/replenishment/replenishment.py +58 -69
  63. sp_api/api/reports/reports.py +124 -157
  64. sp_api/api/sales/sales.py +22 -39
  65. sp_api/api/seller_wallet/__init__.py +0 -0
  66. sp_api/api/seller_wallet/seller_wallet.py +92 -0
  67. sp_api/api/seller_wallet/seller_wallet_2024_03_01.py +300 -0
  68. sp_api/api/sellers/sellers.py +15 -35
  69. sp_api/api/services/services.py +479 -82
  70. sp_api/api/shipment_invoicing/__init__.py +0 -0
  71. sp_api/api/shipment_invoicing/shipment_invoicing.py +92 -0
  72. sp_api/api/shipment_invoicing/shipment_invoicing_v0.py +101 -0
  73. sp_api/api/shipping/shipping.py +94 -440
  74. sp_api/api/shipping/shippingV2.py +183 -474
  75. sp_api/api/shipping/shipping_v1.py +330 -0
  76. sp_api/api/shipping/shipping_v2.py +723 -0
  77. sp_api/api/solicitations/solicitations.py +28 -18
  78. sp_api/api/supply_sources/supply_sources.py +67 -57
  79. sp_api/api/tokens/tokens.py +14 -35
  80. sp_api/api/vehicles/__init__.py +0 -0
  81. sp_api/api/vehicles/vehicles.py +92 -0
  82. sp_api/api/vehicles/vehicles_2024_11_01.py +33 -0
  83. sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +16 -29
  84. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +116 -189
  85. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_2021_12_28.py +114 -0
  86. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_v1.py +114 -0
  87. sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +15 -225
  88. sp_api/api/vendor_direct_fulfillment_sandbox_test_data/__init__.py +0 -0
  89. sp_api/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data.py +92 -0
  90. sp_api/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.py +50 -0
  91. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +122 -624
  92. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_2021_12_28.py +390 -0
  93. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_v1.py +320 -0
  94. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +113 -29
  95. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_2021_12_28.py +47 -0
  96. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_v1.py +47 -0
  97. sp_api/api/vendor_invoices/vendor_invoices.py +15 -264
  98. sp_api/api/vendor_orders/vendor_orders.py +83 -131
  99. sp_api/api/vendor_shipments/vendor_shipments.py +149 -68
  100. sp_api/api/vendor_transaction_status/vendor_transaction_status.py +16 -11
  101. sp_api/asyncio/api/__init__.py +159 -4
  102. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +84 -110
  103. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu_2024_05_09.py +457 -0
  104. sp_api/asyncio/api/aplus_content/aplus_content.py +176 -125
  105. sp_api/asyncio/api/application_integrations/application_integrations.py +59 -68
  106. sp_api/asyncio/api/application_management/application_management.py +20 -13
  107. sp_api/asyncio/api/authorization/authorization.py +8 -26
  108. sp_api/asyncio/api/catalog/catalog.py +27 -61
  109. sp_api/asyncio/api/catalog_items/catalog_items.py +94 -71
  110. sp_api/asyncio/api/catalog_items/catalog_items_2020_12_01.py +87 -0
  111. sp_api/asyncio/api/catalog_items/catalog_items_2022_04_01.py +90 -0
  112. sp_api/asyncio/api/customer_feedback/customer_feedback.py +100 -0
  113. sp_api/asyncio/api/data_kiosk/data_kiosk.py +80 -75
  114. sp_api/asyncio/api/delivery_by_amazon/__init__.py +0 -0
  115. sp_api/asyncio/api/delivery_by_amazon/delivery_by_amazon.py +92 -0
  116. sp_api/asyncio/api/delivery_by_amazon/delivery_by_amazon_2022_07_01.py +82 -0
  117. sp_api/asyncio/api/easy_ship/easy_ship.py +121 -111
  118. sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +212 -435
  119. sp_api/asyncio/api/external_fulfillment/inventory.py +126 -0
  120. sp_api/asyncio/api/external_fulfillment/inventory_2021_01_06.py +73 -0
  121. sp_api/asyncio/api/external_fulfillment/inventory_2024_09_11.py +98 -0
  122. sp_api/asyncio/api/external_fulfillment/returns.py +124 -0
  123. sp_api/asyncio/api/external_fulfillment/returns_2021_08_19.py +90 -0
  124. sp_api/asyncio/api/external_fulfillment/returns_2024_09_11.py +143 -0
  125. sp_api/asyncio/api/external_fulfillment/shipping.py +124 -0
  126. sp_api/asyncio/api/external_fulfillment/shipping_2021_01_06.py +258 -0
  127. sp_api/asyncio/api/external_fulfillment/shipping_2024_09_11.py +235 -0
  128. sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +31 -25
  129. sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +61 -100
  130. sp_api/asyncio/api/feeds/feeds.py +75 -243
  131. sp_api/asyncio/api/feeds/feeds_2021_06_30.py +318 -0
  132. sp_api/asyncio/api/finances/finances.py +123 -91
  133. sp_api/asyncio/api/finances/finances_2024_06_01.py +72 -0
  134. sp_api/asyncio/api/finances/finances_2024_06_19.py +115 -0
  135. sp_api/asyncio/api/finances/finances_v0.py +117 -0
  136. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +107 -1785
  137. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound_2024_03_20.py +1723 -0
  138. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound_v0.py +1385 -0
  139. sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +257 -481
  140. sp_api/asyncio/api/inventories/inventories.py +79 -42
  141. sp_api/asyncio/api/invoices/__init__.py +0 -0
  142. sp_api/asyncio/api/invoices/invoices.py +92 -0
  143. sp_api/asyncio/api/invoices/invoices_2024_06_19.py +345 -0
  144. sp_api/asyncio/api/listings_items/listings_items.py +109 -163
  145. sp_api/asyncio/api/listings_items/listings_items_2020_09_01.py +190 -0
  146. sp_api/asyncio/api/listings_items/listings_items_2021_08_01.py +233 -0
  147. sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +23 -10
  148. sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +110 -222
  149. sp_api/asyncio/api/messaging/messaging.py +185 -199
  150. sp_api/asyncio/api/notifications/notifications.py +145 -107
  151. sp_api/asyncio/api/orders/orders.py +9 -46
  152. sp_api/asyncio/api/orders/orders_2026_01_01.py +19 -65
  153. sp_api/asyncio/api/orders/orders_v0.py +152 -184
  154. sp_api/asyncio/api/product_fees/product_fees.py +101 -75
  155. sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +47 -36
  156. sp_api/asyncio/api/products/products.py +94 -387
  157. sp_api/asyncio/api/products/products_2022_05_01.py +109 -0
  158. sp_api/asyncio/api/products/products_v0.py +388 -0
  159. sp_api/asyncio/api/replenishment/replenishment.py +59 -70
  160. sp_api/asyncio/api/reports/reports.py +124 -157
  161. sp_api/asyncio/api/sales/sales.py +22 -39
  162. sp_api/asyncio/api/seller_wallet/__init__.py +0 -0
  163. sp_api/asyncio/api/seller_wallet/seller_wallet.py +92 -0
  164. sp_api/asyncio/api/seller_wallet/seller_wallet_2024_03_01.py +301 -0
  165. sp_api/asyncio/api/sellers/sellers.py +16 -36
  166. sp_api/asyncio/api/services/services.py +479 -82
  167. sp_api/asyncio/api/shipment_invoicing/__init__.py +0 -0
  168. sp_api/asyncio/api/shipment_invoicing/shipment_invoicing.py +92 -0
  169. sp_api/asyncio/api/shipment_invoicing/shipment_invoicing_v0.py +102 -0
  170. sp_api/asyncio/api/shipping/shipping.py +94 -441
  171. sp_api/asyncio/api/shipping/shippingV2.py +181 -472
  172. sp_api/asyncio/api/shipping/shipping_v1.py +331 -0
  173. sp_api/asyncio/api/shipping/shipping_v2.py +717 -0
  174. sp_api/asyncio/api/solicitations/solicitations.py +29 -19
  175. sp_api/asyncio/api/supply_sources/supply_sources.py +67 -57
  176. sp_api/asyncio/api/tokens/tokens.py +14 -35
  177. sp_api/asyncio/api/vehicles/__init__.py +0 -0
  178. sp_api/asyncio/api/vehicles/vehicles.py +92 -0
  179. sp_api/asyncio/api/vehicles/vehicles_2024_11_01.py +34 -0
  180. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +16 -29
  181. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +120 -192
  182. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_2021_12_28.py +116 -0
  183. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_v1.py +115 -0
  184. sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +15 -225
  185. sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/__init__.py +0 -0
  186. sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data.py +92 -0
  187. sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.py +51 -0
  188. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +120 -623
  189. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_2021_12_28.py +392 -0
  190. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_v1.py +321 -0
  191. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +112 -29
  192. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_2021_12_28.py +49 -0
  193. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_v1.py +48 -0
  194. sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +16 -265
  195. sp_api/asyncio/api/vendor_orders/vendor_orders.py +84 -132
  196. sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +150 -69
  197. sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +17 -12
  198. sp_api/asyncio/base/client.py +2 -2
  199. sp_api/asyncio/util/load_date_bound.py +1 -1
  200. sp_api/base/__init__.py +10 -0
  201. sp_api/base/_core.py +2 -2
  202. sp_api/base/client.py +3 -3
  203. sp_api/base/helpers.py +12 -1
  204. sp_api/base/marketplaces.py +6 -3
  205. sp_api/util/__init__.py +2 -0
  206. sp_api/util/load_date_bound.py +1 -1
  207. sp_api/util/versioned_client.py +45 -0
  208. python_amazon_sp_api-2.0.15.dist-info/RECORD +0 -255
  209. sp_api/asyncio/api/models/__init__.py +0 -4
  210. sp_api/asyncio/api/overrides/__init__.py +0 -1
  211. {python_amazon_sp_api-2.0.15.data → python_amazon_sp_api-2.1.3.data}/scripts/make_endpoint +0 -0
  212. {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/WHEEL +0 -0
  213. {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/licenses/LICENSE +0 -0
  214. {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,318 @@
1
+ import zlib
2
+
3
+ from sp_api.base import sp_endpoint, fill_query_params, ApiResponse
4
+ from sp_api.asyncio.base import AsyncBaseClient
5
+ from sp_api.util import should_add_marketplace
6
+
7
+
8
+ class FeedsV20210630(AsyncBaseClient):
9
+ """
10
+ Feeds SP-API Client
11
+ :link:
12
+
13
+ The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
14
+ """
15
+
16
+ @sp_endpoint("/feeds/2021-06-30/feeds", method="GET")
17
+ async def get_feeds(self, **kwargs) -> ApiResponse:
18
+ """
19
+ get_feeds(self, **kwargs) -> ApiResponse
20
+
21
+ Returns feed details for the feeds that match the filters that you specify.
22
+
23
+ **Usage Plan:**
24
+
25
+ ====================================== ==============
26
+ Rate (requests per second) Burst
27
+ ====================================== ==============
28
+ 0.0222 10
29
+ ====================================== ==============
30
+
31
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
32
+
33
+ Examples:
34
+ literal blocks::
35
+
36
+ await FeedsV20210630().get_feeds()
37
+
38
+ Args:
39
+ key feedTypes: object | A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required.
40
+ key marketplaceIds: object | A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify.
41
+ key pageSize: object | The maximum number of feeds to return in a single call.
42
+ key processingStatuses: object | A list of processing statuses used to filter feeds.
43
+ key createdSince: object | The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days.
44
+ key createdUntil: object | The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now.
45
+ key nextToken: object | A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail.
46
+
47
+ Returns:
48
+ ApiResponse
49
+ """
50
+
51
+ add_marketplace = should_add_marketplace(kwargs, "nextToken")
52
+ return await self._request(
53
+ kwargs.pop("path"), params=kwargs, add_marketplace=add_marketplace
54
+ )
55
+
56
+ async def submit_feed(
57
+ self, feed_type, file, content_type="text/tsv", **kwargs
58
+ ) -> [ApiResponse, ApiResponse]:
59
+ """
60
+ submit_feed(self, feed_type, file, content_type, **kwargs) -> [ApiResponse, ApiResponse]
61
+
62
+ Combines `create_feed_document` and `create_feed`, uploads the file and sends the feed to amazon.
63
+
64
+ Examples:
65
+ literal blocks::
66
+
67
+ await FeedsV20210630().submit_feed("value", "value", "value")
68
+
69
+ Args:
70
+ feed_type: | required
71
+ file: | required
72
+ content_type: | required
73
+ **kwargs:
74
+
75
+ Returns:
76
+ [ApiResponse, ApiResponse]
77
+ """
78
+ document_response = await self.create_feed_document(file, content_type)
79
+ return document_response, await self.create_feed(
80
+ feed_type, document_response.payload.get("feedDocumentId"), **kwargs
81
+ )
82
+
83
+ @sp_endpoint("/feeds/2021-06-30/feeds", method="POST")
84
+ async def create_feed(self, feed_type, input_feed_document_id, **kwargs) -> ApiResponse:
85
+ """
86
+ create_feed(self, feed_type, input_feed_document_id, **kwargs) -> ApiResponse
87
+
88
+ Creates a feed. Upload the contents of the feed document before calling this operation.
89
+
90
+ **Usage Plan:**
91
+
92
+ ====================================== ==============
93
+ Rate (requests per second) Burst
94
+ ====================================== ==============
95
+ 0.0083 15
96
+ ====================================== ==============
97
+
98
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
99
+
100
+ Examples:
101
+ literal blocks::
102
+
103
+ await FeedsV20210630().create_feed("value", "value")
104
+
105
+ Args:
106
+ body: CreateFeedSpecification | required Information required to create the feed.
107
+
108
+ Returns:
109
+ ApiResponse
110
+ """
111
+ data = {
112
+ "feedType": feed_type,
113
+ "inputFeedDocumentId": input_feed_document_id,
114
+ **kwargs,
115
+ }
116
+ return await self._request(kwargs.pop("path"), data=data)
117
+
118
+ @sp_endpoint("/feeds/2021-06-30/feeds/{}", method="DELETE")
119
+ async def cancel_feed(self, feedId, **kwargs) -> ApiResponse:
120
+ """
121
+ cancel_feed(self, feedId, **kwargs) -> ApiResponse
122
+
123
+ Cancels the feed that you specify. Only feeds with `processingStatus=IN_QUEUE` can be cancelled. Cancelled feeds are returned in subsequent calls to the [`getFeed`](https://developer-docs.amazon.com/sp-api/reference/getfeed) and [`getFeeds`](https://developer-docs.amazon.com/sp-api/reference/getfeeds) operations.
124
+
125
+ **Usage Plan:**
126
+
127
+ ====================================== ==============
128
+ Rate (requests per second) Burst
129
+ ====================================== ==============
130
+ 2 15
131
+ ====================================== ==============
132
+
133
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
134
+
135
+ Examples:
136
+ literal blocks::
137
+
138
+ await FeedsV20210630().cancel_feed("value")
139
+
140
+ Args:
141
+ feedId: object | required The identifier for the feed. This identifier is unique only in combination with a seller ID.
142
+
143
+ Returns:
144
+ ApiResponse
145
+ """
146
+
147
+ return await self._request(fill_query_params(kwargs.pop("path"), feedId), data=kwargs)
148
+
149
+ @sp_endpoint("/feeds/2021-06-30/feeds/{}", method="GET")
150
+ async def get_feed(self, feedId, **kwargs) -> ApiResponse:
151
+ """
152
+ get_feed(self, feedId, **kwargs) -> ApiResponse
153
+
154
+ Returns feed details (including the `resultDocumentId`, if available) for the feed that you specify.
155
+
156
+ **Usage Plan:**
157
+
158
+ ====================================== ==============
159
+ Rate (requests per second) Burst
160
+ ====================================== ==============
161
+ 2 15
162
+ ====================================== ==============
163
+
164
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
165
+
166
+ Examples:
167
+ literal blocks::
168
+
169
+ await FeedsV20210630().get_feed("value")
170
+
171
+ Args:
172
+ feedId: object | required The identifier for the feed. This identifier is unique only in combination with a seller ID.
173
+
174
+ Returns:
175
+ ApiResponse
176
+ """
177
+
178
+ return await self._request(
179
+ fill_query_params(kwargs.pop("path"), feedId),
180
+ params=kwargs,
181
+ add_marketplace=False,
182
+ )
183
+
184
+ @sp_endpoint("/feeds/2021-06-30/documents", method="POST")
185
+ async def create_feed_document(self, file, content_type, **kwargs) -> ApiResponse:
186
+ """
187
+ create_feed_document(self, file, content_type, **kwargs) -> ApiResponse
188
+
189
+ Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a `feedDocumentId` value that you can pass in with a subsequent call to the [`createFeed`](https://developer-docs.amazon.com/sp-api/reference/createfeed) operation.
190
+
191
+ **Usage Plan:**
192
+
193
+ ====================================== ==============
194
+ Rate (requests per second) Burst
195
+ ====================================== ==============
196
+ 0.5 15
197
+ ====================================== ==============
198
+
199
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
200
+
201
+ Examples:
202
+ literal blocks::
203
+
204
+ await FeedsV20210630().create_feed_document("value", "value")
205
+
206
+ Args:
207
+ body: CreateFeedDocumentSpecification | required Specifies the content type for the createFeedDocument operation.
208
+
209
+ Returns:
210
+ ApiResponse
211
+ """
212
+ data = {"contentType": kwargs.get("contentType", content_type)}
213
+ response = await self._request(kwargs.get("path"), data={**data, **kwargs})
214
+
215
+ if file is None:
216
+ return response
217
+
218
+ upload_data = file.read()
219
+ try:
220
+ upload_data = upload_data.encode("iso-8859-1")
221
+ except AttributeError:
222
+ pass
223
+ upload = await self._transport.request(
224
+ "PUT",
225
+ response.payload.get("url"),
226
+ content=upload_data,
227
+ headers={"Content-Type": content_type},
228
+ )
229
+ if 200 <= upload.status_code < 300:
230
+ return response
231
+ from sp_api.base.exceptions import SellingApiException
232
+
233
+ raise SellingApiException(
234
+ headers=upload.headers, error=upload.json().get("errors")
235
+ )
236
+
237
+ @sp_endpoint("/feeds/2021-06-30/documents/{}", method="GET")
238
+ async def get_feed_document(self, feedDocumentId, **kwargs) -> str:
239
+ """
240
+ get_feed_document(self, feedDocumentId, **kwargs) -> str
241
+
242
+ Returns the information required for retrieving a feed document's contents.
243
+
244
+ **Usage Plan:**
245
+
246
+ ====================================== ==============
247
+ Rate (requests per second) Burst
248
+ ====================================== ==============
249
+ 0.0222 10
250
+ ====================================== ==============
251
+
252
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
253
+
254
+ Examples:
255
+ literal blocks::
256
+
257
+ await FeedsV20210630().get_feed_document("value")
258
+
259
+ Args:
260
+ feedDocumentId: object | required The identifier of the feed document.
261
+
262
+ Returns:
263
+ str
264
+ """
265
+
266
+ return await self.get_feed_result_document(feedDocumentId)
267
+
268
+ @sp_endpoint("/feeds/2021-06-30/documents/{}", method="GET")
269
+ async def get_feed_result_document(self, feedDocumentId, **kwargs) -> str:
270
+ """
271
+ get_feed_result_document(self, feedDocumentId, **kwargs) -> str
272
+
273
+ Returns the information required for retrieving a feed document's contents.
274
+
275
+ **Usage Plan:**
276
+
277
+ ====================================== ==============
278
+ Rate (requests per second) Burst
279
+ ====================================== ==============
280
+ 0.0222 10
281
+ ====================================== ==============
282
+
283
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
284
+
285
+ Examples:
286
+ literal blocks::
287
+
288
+ await FeedsV20210630().get_feed_result_document("value")
289
+
290
+ Args:
291
+ feedDocumentId: object | required The identifier of the feed document.
292
+
293
+ Returns:
294
+ str
295
+ """
296
+ response = await self._request(
297
+ fill_query_params(kwargs.pop("path"), feedDocumentId),
298
+ params=kwargs,
299
+ add_marketplace=False,
300
+ )
301
+ url = response.payload.get("url")
302
+ doc_response = await self._transport.request("GET", url)
303
+
304
+ encoding = (
305
+ doc_response.encoding
306
+ if doc_response and doc_response.encoding
307
+ else "iso-8859-1"
308
+ )
309
+ if encoding.lower() == "windows-31j":
310
+ encoding = "cp932"
311
+
312
+ content = doc_response.content
313
+ if "compressionAlgorithm" in response.payload:
314
+ try:
315
+ return zlib.decompress(bytearray(content), 15 + 32).decode(encoding)
316
+ except Exception:
317
+ return content.decode(encoding)
318
+ return content.decode(encoding)
@@ -1,100 +1,132 @@
1
+ from __future__ import annotations
2
+
1
3
  import enum
4
+ from typing import Any, Literal, TYPE_CHECKING, overload
2
5
 
3
- from sp_api.base import Client, Marketplaces, ApiResponse
4
6
  from sp_api.asyncio.base import AsyncBaseClient
5
- from sp_api.base import sp_endpoint, fill_query_params
7
+ from sp_api.util.versioned_client import VersionedClientMeta
8
+
9
+ from .finances_2024_06_01 import FinancesV20240601
10
+ from .finances_2024_06_19 import FinancesV20240619
11
+ from .finances_v0 import FinancesV0
12
+
6
13
 
7
14
  class FinancesVersion(str, enum.Enum):
8
- V_0 = "v0"
15
+ V0 = "v0"
16
+ V_2024_06_01 = "2024-06-01"
9
17
  V_2024_06_19 = "2024-06-19"
10
18
  LATEST = "2024-06-19"
11
19
 
12
20
 
13
- class Finances(AsyncBaseClient):
14
- version: FinancesVersion = FinancesVersion.V_0
15
-
16
- def __init__(self, *args, **kwargs):
17
- if "version" in kwargs:
18
- self.version = kwargs.get("version", FinancesVersion.V_0)
19
- super().__init__(*args, **{**kwargs, "version": self.version})
20
-
21
- @sp_endpoint("/finances/<version>/orders/{}/financialEvents")
22
- async def get_financial_events_for_order(self, order_id, **kwargs) -> ApiResponse:
23
- """
24
- get_financial_events_for_order(self, order_id, **kwargs) -> ApiResponse
25
-
26
- Examples:
27
- literal blocks::
28
-
29
- Finances().get_financial_events_for_order('485-734-5434857', MaxResultsPerPage=10)
30
-
31
- Args:
32
- order_id:
33
- **kwargs:
34
-
35
- Returns:
36
-
37
- """
38
- return await self._request(
39
- fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
40
- )
41
-
42
- @sp_endpoint("/finances/<version>/financialEvents")
43
- async def list_financial_events(self, **kwargs) -> ApiResponse:
44
- """
45
- list_financial_events(self, **kwargs) -> ApiResponse:
46
-
47
-
48
- Args:
49
- **kwargs:
50
-
51
- Returns:
52
-
53
- """
54
- return await self._request(fill_query_params(kwargs.pop("path")), params={**kwargs})
55
-
56
- @sp_endpoint("/finances/<version>/financialEventGroups/{}/financialEvents")
57
- async def list_financial_events_by_group_id(
58
- self, event_group_id, **kwargs
59
- ) -> ApiResponse:
60
- """
61
- list_financial_events_by_groupid(self, event_group_id, **kwargs) -> ApiResponse:
62
-
63
-
64
- Args:
65
- event_group_id
66
- **kwargs:
67
-
68
- Returns:
69
-
70
- """
71
- return await self._request(
72
- fill_query_params(kwargs.pop("path"), event_group_id), params={**kwargs}
73
- )
74
-
75
- @sp_endpoint("/finances/<version>/financialEventGroups")
76
- async def list_financial_event_groups(self, **kwargs) -> ApiResponse:
77
- """
78
- list_financial_event_groups(self, **kwargs) -> ApiResponse:
79
-
80
-
81
- Args:
82
- **kwargs:
83
-
84
- Returns:
85
-
86
- """
87
- return await self._request(kwargs.pop("path"), params={**kwargs})
88
-
89
- @sp_endpoint("/finances/<version>/transactions")
90
- async def list_transactions(self, **kwargs) -> ApiResponse:
91
- """
92
- list_transactions(self, **kwargs) -> ApiResponse:
93
-
94
- Args:
95
- **kwargs:
96
-
97
- Returns: ApiResponse
98
- """
99
-
100
- return await self._request(kwargs.pop("path"), params={**kwargs})
21
+ if TYPE_CHECKING:
22
+
23
+ class _FinancesMeta(VersionedClientMeta):
24
+ @overload
25
+ def __call__(
26
+ cls,
27
+ *args: Any,
28
+ version: Literal[FinancesVersion.V_2024_06_19, FinancesVersion.LATEST, "2024-06-19"],
29
+ **kwargs: Any,
30
+ ) -> FinancesV20240619: ...
31
+
32
+ @overload
33
+ def __call__(
34
+ cls,
35
+ *args: Any,
36
+ version: Literal[FinancesVersion.V_2024_06_01, "2024-06-01"],
37
+ **kwargs: Any,
38
+ ) -> FinancesV20240601: ...
39
+
40
+ @overload
41
+ def __call__(
42
+ cls,
43
+ *args: Any,
44
+ version: Literal[FinancesVersion.V0, "v0"],
45
+ **kwargs: Any,
46
+ ) -> FinancesV0: ...
47
+
48
+ @overload
49
+ def __call__(
50
+ cls,
51
+ *args: Any,
52
+ version: None = None,
53
+ **kwargs: Any,
54
+ ) -> FinancesV0: ...
55
+
56
+ @overload
57
+ def __call__(
58
+ cls,
59
+ *args: Any,
60
+ version: str | FinancesVersion,
61
+ **kwargs: Any,
62
+ ) -> AsyncBaseClient: ...
63
+
64
+
65
+ else:
66
+ _FinancesMeta = VersionedClientMeta
67
+
68
+
69
+ class Finances(AsyncBaseClient, metaclass=_FinancesMeta):
70
+ """Finances API client.
71
+
72
+ This class dispatches to a versioned Finances API client.
73
+
74
+ If you do not pass a version, the constructor returns the oldest supported implementation ("v0").
75
+ """
76
+
77
+ if TYPE_CHECKING:
78
+ @overload
79
+ def __new__(
80
+ cls,
81
+ *args: Any,
82
+ version: Literal[FinancesVersion.V_2024_06_19, FinancesVersion.LATEST, "2024-06-19"],
83
+ **kwargs: Any,
84
+ ) -> FinancesV20240619: ...
85
+
86
+ @overload
87
+ def __new__(
88
+ cls,
89
+ *args: Any,
90
+ version: Literal[FinancesVersion.V_2024_06_01, "2024-06-01"],
91
+ **kwargs: Any,
92
+ ) -> FinancesV20240601: ...
93
+
94
+ @overload
95
+ def __new__(
96
+ cls,
97
+ *args: Any,
98
+ version: Literal[FinancesVersion.V0, "v0"],
99
+ **kwargs: Any,
100
+ ) -> FinancesV0: ...
101
+
102
+ @overload
103
+ def __new__(
104
+ cls,
105
+ *args: Any,
106
+ version: None = None,
107
+ **kwargs: Any,
108
+ ) -> FinancesV0: ...
109
+
110
+ @overload
111
+ def __new__(
112
+ cls,
113
+ *args: Any,
114
+ version: str | FinancesVersion,
115
+ **kwargs: Any,
116
+ ) -> AsyncBaseClient: ...
117
+
118
+ _DISPATCH = True
119
+
120
+ _DEFAULT_VERSION = "v0"
121
+
122
+ _VERSION_MAP = {
123
+ "v0": FinancesV0,
124
+ "2024-06-01": FinancesV20240601,
125
+ "2024-06-19": FinancesV20240619,
126
+ }
127
+
128
+ _VERSION_ALIASES = {
129
+ "v0": "v0",
130
+ "2024-06-01": "2024-06-01",
131
+ "2024-06-19": "2024-06-19",
132
+ }
@@ -0,0 +1,72 @@
1
+ from sp_api.base import ApiResponse, sp_endpoint, fill_query_params
2
+ from sp_api.asyncio.base import AsyncBaseClient
3
+
4
+
5
+ class FinancesV20240601(AsyncBaseClient):
6
+ """
7
+ Finances Transfers SP-API Client
8
+ :link:
9
+
10
+ The Selling Partner API for Transfers enables selling partners to retrieve payment methods and initiate payouts for their seller accounts. This API supports the following marketplaces: DE, FR, IT, ES, SE, NL, PL, and BE.
11
+ """
12
+
13
+ @sp_endpoint("/finances/transfers/2024-06-01/payouts", method="POST")
14
+ async def initiate_payout(self, **kwargs) -> ApiResponse:
15
+ """
16
+ initiate_payout(self, **kwargs) -> ApiResponse
17
+
18
+ Initiates an on-demand payout to the seller's default deposit method in Seller Central for the given `marketplaceId` and `accountType`, if eligible. You can only initiate one on-demand payout for each marketplace and account type within a 24-hour period.
19
+
20
+ **Usage Plan:**
21
+
22
+ ====================================== ==============
23
+ Rate (requests per second) Burst
24
+ ====================================== ==============
25
+ 0.017 2
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
+ await FinancesV20240601().initiate_payout()
34
+
35
+ Args:
36
+ body: InitiatePayoutRequest | required The request body for the `initiatePayout` operation.
37
+
38
+ Returns:
39
+ ApiResponse
40
+ """
41
+ return await self._request(kwargs.pop("path"), data=kwargs, add_marketplace=False)
42
+
43
+ @sp_endpoint("/finances/transfers/2024-06-01/paymentMethods", method="GET")
44
+ async def get_payment_methods(self, **kwargs) -> ApiResponse:
45
+ """
46
+ get_payment_methods(self, **kwargs) -> ApiResponse
47
+
48
+ Returns the list of payment methods for the seller, which can be filtered by method type.
49
+
50
+ **Usage Plan:**
51
+
52
+ ====================================== ==============
53
+ Rate (requests per second) Burst
54
+ ====================================== ==============
55
+ .5 30
56
+ ====================================== ==============
57
+
58
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
59
+
60
+ Examples:
61
+ literal blocks::
62
+
63
+ await FinancesV20240601().get_payment_methods()
64
+
65
+ Args:
66
+ key marketplaceId: object | required The identifier of the marketplace from which you want to retrieve payment methods. For the list of possible marketplace identifiers, refer to [Marketplace IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids).
67
+ key paymentMethodTypes: object | A comma-separated list of the payment method types you want to include in the response.
68
+
69
+ Returns:
70
+ ApiResponse
71
+ """
72
+ return await self._request(kwargs.pop("path"), params=kwargs, add_marketplace=False)