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,320 @@
1
+ import zlib
2
+
3
+ import httpx
4
+
5
+ from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
6
+ from sp_api.util import should_add_marketplace
7
+
8
+
9
+ class FeedsV20210630(Client):
10
+ """
11
+ Feeds SP-API Client
12
+ :link:
13
+
14
+ The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
15
+ """
16
+
17
+ @sp_endpoint("/feeds/2021-06-30/feeds", method="GET")
18
+ def get_feeds(self, **kwargs) -> ApiResponse:
19
+ """
20
+ get_feeds(self, **kwargs) -> ApiResponse
21
+
22
+ Returns feed details for the feeds that match the filters that you specify.
23
+
24
+ **Usage Plan:**
25
+
26
+ ====================================== ==============
27
+ Rate (requests per second) Burst
28
+ ====================================== ==============
29
+ 0.0222 10
30
+ ====================================== ==============
31
+
32
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
33
+
34
+ Examples:
35
+ literal blocks::
36
+
37
+ FeedsV20210630().get_feeds()
38
+
39
+ Args:
40
+ 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.
41
+ 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.
42
+ key pageSize: object | The maximum number of feeds to return in a single call.
43
+ key processingStatuses: object | A list of processing statuses used to filter feeds.
44
+ 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.
45
+ key createdUntil: object | The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now.
46
+ 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.
47
+
48
+ Returns:
49
+ ApiResponse
50
+ """
51
+
52
+ add_marketplace = should_add_marketplace(kwargs, "nextToken")
53
+ return self._request(
54
+ kwargs.pop("path"), params=kwargs, add_marketplace=add_marketplace
55
+ )
56
+
57
+ def submit_feed(
58
+ self, feed_type, file, content_type="text/tsv", **kwargs
59
+ ) -> [ApiResponse, ApiResponse]:
60
+ """
61
+ submit_feed(self, feed_type, file, content_type, **kwargs) -> [ApiResponse, ApiResponse]
62
+
63
+ Combines `create_feed_document` and `create_feed`, uploads the file and sends the feed to amazon.
64
+
65
+ Examples:
66
+ literal blocks::
67
+
68
+ FeedsV20210630().submit_feed("value", "value", "value")
69
+
70
+ Args:
71
+ feed_type: | required
72
+ file: | required
73
+ content_type: | required
74
+ **kwargs:
75
+
76
+ Returns:
77
+ [ApiResponse, ApiResponse]
78
+ """
79
+ document_response = self.create_feed_document(file, content_type)
80
+ return document_response, self.create_feed(
81
+ feed_type, document_response.payload.get("feedDocumentId"), **kwargs
82
+ )
83
+
84
+ @sp_endpoint("/feeds/2021-06-30/feeds", method="POST")
85
+ def create_feed(self, feed_type, input_feed_document_id, **kwargs) -> ApiResponse:
86
+ """
87
+ create_feed(self, feed_type, input_feed_document_id, **kwargs) -> ApiResponse
88
+
89
+ Creates a feed. Upload the contents of the feed document before calling this operation.
90
+
91
+ **Usage Plan:**
92
+
93
+ ====================================== ==============
94
+ Rate (requests per second) Burst
95
+ ====================================== ==============
96
+ 0.0083 15
97
+ ====================================== ==============
98
+
99
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
100
+
101
+ Examples:
102
+ literal blocks::
103
+
104
+ FeedsV20210630().create_feed("value", "value")
105
+
106
+ Args:
107
+ body: CreateFeedSpecification | required Information required to create the feed.
108
+
109
+ Returns:
110
+ ApiResponse
111
+ """
112
+ data = {
113
+ "feedType": feed_type,
114
+ "inputFeedDocumentId": input_feed_document_id,
115
+ **kwargs,
116
+ }
117
+ return self._request(kwargs.pop("path"), data=data)
118
+
119
+ @sp_endpoint("/feeds/2021-06-30/feeds/{}", method="DELETE")
120
+ def cancel_feed(self, feedId, **kwargs) -> ApiResponse:
121
+ """
122
+ cancel_feed(self, feedId, **kwargs) -> ApiResponse
123
+
124
+ 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.
125
+
126
+ **Usage Plan:**
127
+
128
+ ====================================== ==============
129
+ Rate (requests per second) Burst
130
+ ====================================== ==============
131
+ 2 15
132
+ ====================================== ==============
133
+
134
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
135
+
136
+ Examples:
137
+ literal blocks::
138
+
139
+ FeedsV20210630().cancel_feed("value")
140
+
141
+ Args:
142
+ feedId: object | required The identifier for the feed. This identifier is unique only in combination with a seller ID.
143
+
144
+ Returns:
145
+ ApiResponse
146
+ """
147
+
148
+ return self._request(fill_query_params(kwargs.pop("path"), feedId), data=kwargs)
149
+
150
+ @sp_endpoint("/feeds/2021-06-30/feeds/{}", method="GET")
151
+ def get_feed(self, feedId, **kwargs) -> ApiResponse:
152
+ """
153
+ get_feed(self, feedId, **kwargs) -> ApiResponse
154
+
155
+ Returns feed details (including the `resultDocumentId`, if available) for the feed that you specify.
156
+
157
+ **Usage Plan:**
158
+
159
+ ====================================== ==============
160
+ Rate (requests per second) Burst
161
+ ====================================== ==============
162
+ 2 15
163
+ ====================================== ==============
164
+
165
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
166
+
167
+ Examples:
168
+ literal blocks::
169
+
170
+ FeedsV20210630().get_feed("value")
171
+
172
+ Args:
173
+ feedId: object | required The identifier for the feed. This identifier is unique only in combination with a seller ID.
174
+
175
+ Returns:
176
+ ApiResponse
177
+ """
178
+
179
+ return self._request(
180
+ fill_query_params(kwargs.pop("path"), feedId),
181
+ params=kwargs,
182
+ add_marketplace=False,
183
+ )
184
+
185
+ @sp_endpoint("/feeds/2021-06-30/documents", method="POST")
186
+ def create_feed_document(self, file, content_type, **kwargs) -> ApiResponse:
187
+ """
188
+ create_feed_document(self, file, content_type, **kwargs) -> ApiResponse
189
+
190
+ 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.
191
+
192
+ **Usage Plan:**
193
+
194
+ ====================================== ==============
195
+ Rate (requests per second) Burst
196
+ ====================================== ==============
197
+ 0.5 15
198
+ ====================================== ==============
199
+
200
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
201
+
202
+ Examples:
203
+ literal blocks::
204
+
205
+ FeedsV20210630().create_feed_document("value", "value")
206
+
207
+ Args:
208
+ body: CreateFeedDocumentSpecification | required Specifies the content type for the createFeedDocument operation.
209
+
210
+ Returns:
211
+ ApiResponse
212
+ """
213
+ data = {"contentType": kwargs.get("contentType", content_type)}
214
+ response = self._request(kwargs.get("path"), data={**data, **kwargs})
215
+
216
+ if file is None:
217
+ return response
218
+
219
+ upload_data = file.read()
220
+ try:
221
+ upload_data = upload_data.encode("iso-8859-1")
222
+ except AttributeError:
223
+ pass
224
+ with httpx.Client() as client:
225
+ upload = client.put(
226
+ response.payload.get("url"),
227
+ content=upload_data,
228
+ headers={"Content-Type": content_type},
229
+ )
230
+ if 200 <= upload.status_code < 300:
231
+ return response
232
+ from sp_api.base.exceptions import SellingApiException
233
+
234
+ raise SellingApiException(
235
+ headers=upload.headers, error=upload.json().get("errors")
236
+ )
237
+
238
+ @sp_endpoint("/feeds/2021-06-30/documents/{}", method="GET")
239
+ def get_feed_document(self, feedDocumentId, **kwargs) -> str:
240
+ """
241
+ get_feed_document(self, feedDocumentId, **kwargs) -> str
242
+
243
+ Returns the information required for retrieving a feed document's contents.
244
+
245
+ **Usage Plan:**
246
+
247
+ ====================================== ==============
248
+ Rate (requests per second) Burst
249
+ ====================================== ==============
250
+ 0.0222 10
251
+ ====================================== ==============
252
+
253
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
254
+
255
+ Examples:
256
+ literal blocks::
257
+
258
+ FeedsV20210630().get_feed_document("value")
259
+
260
+ Args:
261
+ feedDocumentId: object | required The identifier of the feed document.
262
+
263
+ Returns:
264
+ str
265
+ """
266
+
267
+ return self.get_feed_result_document(feedDocumentId)
268
+
269
+ @sp_endpoint("/feeds/2021-06-30/documents/{}", method="GET")
270
+ def get_feed_result_document(self, feedDocumentId, **kwargs) -> str:
271
+ """
272
+ get_feed_result_document(self, feedDocumentId, **kwargs) -> str
273
+
274
+ Returns the information required for retrieving a feed document's contents.
275
+
276
+ **Usage Plan:**
277
+
278
+ ====================================== ==============
279
+ Rate (requests per second) Burst
280
+ ====================================== ==============
281
+ 0.0222 10
282
+ ====================================== ==============
283
+
284
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
285
+
286
+ Examples:
287
+ literal blocks::
288
+
289
+ FeedsV20210630().get_feed_result_document("value")
290
+
291
+ Args:
292
+ feedDocumentId: object | required The identifier of the feed document.
293
+
294
+ Returns:
295
+ str
296
+ """
297
+ response = self._request(
298
+ fill_query_params(kwargs.pop("path"), feedDocumentId),
299
+ params=kwargs,
300
+ add_marketplace=False,
301
+ )
302
+ url = response.payload.get("url")
303
+ with httpx.Client() as client:
304
+ doc_response = client.get(url)
305
+
306
+ encoding = (
307
+ doc_response.encoding
308
+ if doc_response and doc_response.encoding
309
+ else "iso-8859-1"
310
+ )
311
+ if encoding.lower() == "windows-31j":
312
+ encoding = "cp932"
313
+
314
+ content = doc_response.content
315
+ if "compressionAlgorithm" in response.payload:
316
+ try:
317
+ return zlib.decompress(bytearray(content), 15 + 32).decode(encoding)
318
+ except Exception:
319
+ return content.decode(encoding)
320
+ return content.decode(encoding)
@@ -1,99 +1,132 @@
1
+ from __future__ import annotations
2
+
1
3
  import enum
4
+ from typing import Any, Literal, TYPE_CHECKING, overload
5
+ from sp_api.util.versioned_client import VersionedClientMeta
6
+
7
+ from sp_api.base import Client
8
+
9
+ from .finances_2024_06_01 import FinancesV20240601
10
+ from .finances_2024_06_19 import FinancesV20240619
11
+ from .finances_v0 import FinancesV0
2
12
 
3
- from sp_api.base import Client, Marketplaces, ApiResponse
4
- from sp_api.base import sp_endpoint, fill_query_params
5
13
 
6
14
  class FinancesVersion(str, enum.Enum):
7
15
  V_0 = "v0"
16
+ V_2024_06_01 = "2024-06-01"
8
17
  V_2024_06_19 = "2024-06-19"
9
18
  LATEST = "2024-06-19"
10
19
 
11
20
 
12
- class Finances(Client):
13
- version: FinancesVersion = FinancesVersion.V_0
14
-
15
- def __init__(self, *args, **kwargs):
16
- if "version" in kwargs:
17
- self.version = kwargs.get("version", FinancesVersion.V_0)
18
- super().__init__(*args, **{**kwargs, "version": self.version})
19
-
20
- @sp_endpoint("/finances/<version>/orders/{}/financialEvents")
21
- def get_financial_events_for_order(self, order_id, **kwargs) -> ApiResponse:
22
- """
23
- get_financial_events_for_order(self, order_id, **kwargs) -> ApiResponse
24
-
25
- Examples:
26
- literal blocks::
27
-
28
- Finances().get_financial_events_for_order('485-734-5434857', MaxResultsPerPage=10)
29
-
30
- Args:
31
- order_id:
32
- **kwargs:
33
-
34
- Returns:
35
-
36
- """
37
- return self._request(
38
- fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
39
- )
40
-
41
- @sp_endpoint("/finances/<version>/financialEvents")
42
- def list_financial_events(self, **kwargs) -> ApiResponse:
43
- """
44
- list_financial_events(self, **kwargs) -> ApiResponse:
45
-
46
-
47
- Args:
48
- **kwargs:
49
-
50
- Returns:
51
-
52
- """
53
- return self._request(fill_query_params(kwargs.pop("path")), params={**kwargs})
54
-
55
- @sp_endpoint("/finances/<version>/financialEventGroups/{}/financialEvents")
56
- def list_financial_events_by_group_id(
57
- self, event_group_id, **kwargs
58
- ) -> ApiResponse:
59
- """
60
- list_financial_events_by_groupid(self, event_group_id, **kwargs) -> ApiResponse:
61
-
62
-
63
- Args:
64
- event_group_id
65
- **kwargs:
66
-
67
- Returns:
68
-
69
- """
70
- return self._request(
71
- fill_query_params(kwargs.pop("path"), event_group_id), params={**kwargs}
72
- )
73
-
74
- @sp_endpoint("/finances/<version>/financialEventGroups")
75
- def list_financial_event_groups(self, **kwargs) -> ApiResponse:
76
- """
77
- list_financial_event_groups(self, **kwargs) -> ApiResponse:
78
-
79
-
80
- Args:
81
- **kwargs:
82
-
83
- Returns:
84
-
85
- """
86
- return self._request(kwargs.pop("path"), params={**kwargs})
87
-
88
- @sp_endpoint("/finances/<version>/transactions")
89
- def list_transactions(self, **kwargs) -> ApiResponse:
90
- """
91
- list_transactions(self, **kwargs) -> ApiResponse:
92
-
93
- Args:
94
- **kwargs:
95
-
96
- Returns: ApiResponse
97
- """
98
-
99
- return 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.V_0, "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
+ ) -> Client: ...
63
+
64
+
65
+ else:
66
+ _FinancesMeta = VersionedClientMeta
67
+
68
+
69
+ class Finances(Client, 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.V_0, "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
+ ) -> Client: ...
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,71 @@
1
+ from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
2
+
3
+
4
+ class FinancesV20240601(Client):
5
+ """
6
+ Finances Transfers SP-API Client
7
+ :link:
8
+
9
+ 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.
10
+ """
11
+
12
+ @sp_endpoint("/finances/transfers/2024-06-01/payouts", method="POST")
13
+ def initiate_payout(self, **kwargs) -> ApiResponse:
14
+ """
15
+ initiate_payout(self, **kwargs) -> ApiResponse
16
+
17
+ 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.
18
+
19
+ **Usage Plan:**
20
+
21
+ ====================================== ==============
22
+ Rate (requests per second) Burst
23
+ ====================================== ==============
24
+ 0.017 2
25
+ ====================================== ==============
26
+
27
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
28
+
29
+ Examples:
30
+ literal blocks::
31
+
32
+ FinancesV20240601().initiate_payout()
33
+
34
+ Args:
35
+ body: InitiatePayoutRequest | required The request body for the `initiatePayout` operation.
36
+
37
+ Returns:
38
+ ApiResponse
39
+ """
40
+ return self._request(kwargs.pop("path"), data=kwargs, add_marketplace=False)
41
+
42
+ @sp_endpoint("/finances/transfers/2024-06-01/paymentMethods", method="GET")
43
+ def get_payment_methods(self, **kwargs) -> ApiResponse:
44
+ """
45
+ get_payment_methods(self, **kwargs) -> ApiResponse
46
+
47
+ Returns the list of payment methods for the seller, which can be filtered by method type.
48
+
49
+ **Usage Plan:**
50
+
51
+ ====================================== ==============
52
+ Rate (requests per second) Burst
53
+ ====================================== ==============
54
+ .5 30
55
+ ====================================== ==============
56
+
57
+ For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
58
+
59
+ Examples:
60
+ literal blocks::
61
+
62
+ FinancesV20240601().get_payment_methods()
63
+
64
+ Args:
65
+ 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).
66
+ key paymentMethodTypes: object | A comma-separated list of the payment method types you want to include in the response.
67
+
68
+ Returns:
69
+ ApiResponse
70
+ """
71
+ return self._request(kwargs.pop("path"), params=kwargs, add_marketplace=False)