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.
- {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/METADATA +7 -7
- python_amazon_sp_api-2.1.3.dist-info/RECORD +350 -0
- sp_api/__version__.py +1 -1
- sp_api/api/__init__.py +160 -4
- sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +85 -110
- sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu_2024_05_09.py +456 -0
- sp_api/api/aplus_content/aplus_content.py +176 -125
- sp_api/api/application_integrations/application_integrations.py +59 -68
- sp_api/api/application_management/application_management.py +20 -13
- sp_api/api/authorization/authorization.py +8 -26
- sp_api/api/catalog/catalog.py +27 -61
- sp_api/api/catalog_items/catalog_items.py +108 -78
- sp_api/api/catalog_items/catalog_items_2020_12_01.py +86 -0
- sp_api/api/catalog_items/catalog_items_2022_04_01.py +89 -0
- sp_api/api/customer_feedback/customer_feedback.py +100 -0
- sp_api/api/data_kiosk/data_kiosk.py +80 -75
- sp_api/api/delivery_by_amazon/__init__.py +0 -0
- sp_api/api/delivery_by_amazon/delivery_by_amazon.py +92 -0
- sp_api/api/delivery_by_amazon/delivery_by_amazon_2022_07_01.py +81 -0
- sp_api/api/easy_ship/easy_ship.py +121 -111
- sp_api/api/external_fulfillment/external_fulfillment.py +211 -434
- sp_api/api/external_fulfillment/inventory.py +120 -0
- sp_api/api/external_fulfillment/inventory_2021_01_06.py +71 -0
- sp_api/api/external_fulfillment/inventory_2024_09_11.py +96 -0
- sp_api/api/external_fulfillment/returns.py +120 -0
- sp_api/api/external_fulfillment/returns_2021_08_19.py +88 -0
- sp_api/api/external_fulfillment/returns_2024_09_11.py +141 -0
- sp_api/api/external_fulfillment/shipping.py +120 -0
- sp_api/api/external_fulfillment/shipping_2021_01_06.py +256 -0
- sp_api/api/external_fulfillment/shipping_2024_09_11.py +233 -0
- sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py +30 -24
- sp_api/api/fba_small_and_light/fba_small_and_light.py +60 -99
- sp_api/api/feeds/feeds.py +75 -245
- sp_api/api/feeds/feeds_2021_06_30.py +320 -0
- sp_api/api/finances/finances.py +123 -90
- sp_api/api/finances/finances_2024_06_01.py +71 -0
- sp_api/api/finances/finances_2024_06_19.py +114 -0
- sp_api/api/finances/finances_v0.py +116 -0
- sp_api/api/fulfillment_inbound/fulfillment_inbound.py +107 -1784
- sp_api/api/fulfillment_inbound/fulfillment_inbound_2024_03_20.py +1722 -0
- sp_api/api/fulfillment_inbound/fulfillment_inbound_v0.py +1384 -0
- sp_api/api/fulfillment_outbound/fulfillment_outbound.py +256 -480
- sp_api/api/inventories/inventories.py +79 -42
- sp_api/api/invoices/__init__.py +0 -0
- sp_api/api/invoices/invoices.py +92 -0
- sp_api/api/invoices/invoices_2024_06_19.py +344 -0
- sp_api/api/listings_items/listings_items.py +110 -163
- sp_api/api/listings_items/listings_items_2020_09_01.py +189 -0
- sp_api/api/listings_items/listings_items_2021_08_01.py +233 -0
- sp_api/api/listings_restrictions/listings_restrictions.py +23 -10
- sp_api/api/merchant_fulfillment/merchant_fulfillment.py +107 -222
- sp_api/api/messaging/messaging.py +184 -198
- sp_api/api/notifications/notifications.py +144 -106
- sp_api/api/orders/orders.py +9 -46
- sp_api/api/orders/orders_2026_01_01.py +19 -65
- sp_api/api/orders/orders_v0.py +152 -184
- sp_api/api/product_fees/product_fees.py +101 -75
- sp_api/api/product_type_definitions/product_type_definitions.py +47 -36
- sp_api/api/products/products.py +94 -386
- sp_api/api/products/products_2022_05_01.py +96 -0
- sp_api/api/products/products_v0.py +389 -0
- sp_api/api/replenishment/replenishment.py +58 -69
- sp_api/api/reports/reports.py +124 -157
- sp_api/api/sales/sales.py +22 -39
- sp_api/api/seller_wallet/__init__.py +0 -0
- sp_api/api/seller_wallet/seller_wallet.py +92 -0
- sp_api/api/seller_wallet/seller_wallet_2024_03_01.py +300 -0
- sp_api/api/sellers/sellers.py +15 -35
- sp_api/api/services/services.py +479 -82
- sp_api/api/shipment_invoicing/__init__.py +0 -0
- sp_api/api/shipment_invoicing/shipment_invoicing.py +92 -0
- sp_api/api/shipment_invoicing/shipment_invoicing_v0.py +101 -0
- sp_api/api/shipping/shipping.py +94 -440
- sp_api/api/shipping/shippingV2.py +183 -474
- sp_api/api/shipping/shipping_v1.py +330 -0
- sp_api/api/shipping/shipping_v2.py +723 -0
- sp_api/api/solicitations/solicitations.py +28 -18
- sp_api/api/supply_sources/supply_sources.py +67 -57
- sp_api/api/tokens/tokens.py +14 -35
- sp_api/api/vehicles/__init__.py +0 -0
- sp_api/api/vehicles/vehicles.py +92 -0
- sp_api/api/vehicles/vehicles_2024_11_01.py +33 -0
- sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +16 -29
- sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +116 -189
- sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_2021_12_28.py +114 -0
- sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_v1.py +114 -0
- sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +15 -225
- sp_api/api/vendor_direct_fulfillment_sandbox_test_data/__init__.py +0 -0
- sp_api/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data.py +92 -0
- sp_api/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.py +50 -0
- sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +122 -624
- sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_2021_12_28.py +390 -0
- sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_v1.py +320 -0
- sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +113 -29
- sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_2021_12_28.py +47 -0
- sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_v1.py +47 -0
- sp_api/api/vendor_invoices/vendor_invoices.py +15 -264
- sp_api/api/vendor_orders/vendor_orders.py +83 -131
- sp_api/api/vendor_shipments/vendor_shipments.py +149 -68
- sp_api/api/vendor_transaction_status/vendor_transaction_status.py +16 -11
- sp_api/asyncio/api/__init__.py +159 -4
- sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +84 -110
- sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu_2024_05_09.py +457 -0
- sp_api/asyncio/api/aplus_content/aplus_content.py +176 -125
- sp_api/asyncio/api/application_integrations/application_integrations.py +59 -68
- sp_api/asyncio/api/application_management/application_management.py +20 -13
- sp_api/asyncio/api/authorization/authorization.py +8 -26
- sp_api/asyncio/api/catalog/catalog.py +27 -61
- sp_api/asyncio/api/catalog_items/catalog_items.py +94 -71
- sp_api/asyncio/api/catalog_items/catalog_items_2020_12_01.py +87 -0
- sp_api/asyncio/api/catalog_items/catalog_items_2022_04_01.py +90 -0
- sp_api/asyncio/api/customer_feedback/customer_feedback.py +100 -0
- sp_api/asyncio/api/data_kiosk/data_kiosk.py +80 -75
- sp_api/asyncio/api/delivery_by_amazon/__init__.py +0 -0
- sp_api/asyncio/api/delivery_by_amazon/delivery_by_amazon.py +92 -0
- sp_api/asyncio/api/delivery_by_amazon/delivery_by_amazon_2022_07_01.py +82 -0
- sp_api/asyncio/api/easy_ship/easy_ship.py +121 -111
- sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +212 -435
- sp_api/asyncio/api/external_fulfillment/inventory.py +126 -0
- sp_api/asyncio/api/external_fulfillment/inventory_2021_01_06.py +73 -0
- sp_api/asyncio/api/external_fulfillment/inventory_2024_09_11.py +98 -0
- sp_api/asyncio/api/external_fulfillment/returns.py +124 -0
- sp_api/asyncio/api/external_fulfillment/returns_2021_08_19.py +90 -0
- sp_api/asyncio/api/external_fulfillment/returns_2024_09_11.py +143 -0
- sp_api/asyncio/api/external_fulfillment/shipping.py +124 -0
- sp_api/asyncio/api/external_fulfillment/shipping_2021_01_06.py +258 -0
- sp_api/asyncio/api/external_fulfillment/shipping_2024_09_11.py +235 -0
- sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +31 -25
- sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +61 -100
- sp_api/asyncio/api/feeds/feeds.py +75 -243
- sp_api/asyncio/api/feeds/feeds_2021_06_30.py +318 -0
- sp_api/asyncio/api/finances/finances.py +123 -91
- sp_api/asyncio/api/finances/finances_2024_06_01.py +72 -0
- sp_api/asyncio/api/finances/finances_2024_06_19.py +115 -0
- sp_api/asyncio/api/finances/finances_v0.py +117 -0
- sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +107 -1785
- sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound_2024_03_20.py +1723 -0
- sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound_v0.py +1385 -0
- sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +257 -481
- sp_api/asyncio/api/inventories/inventories.py +79 -42
- sp_api/asyncio/api/invoices/__init__.py +0 -0
- sp_api/asyncio/api/invoices/invoices.py +92 -0
- sp_api/asyncio/api/invoices/invoices_2024_06_19.py +345 -0
- sp_api/asyncio/api/listings_items/listings_items.py +109 -163
- sp_api/asyncio/api/listings_items/listings_items_2020_09_01.py +190 -0
- sp_api/asyncio/api/listings_items/listings_items_2021_08_01.py +233 -0
- sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +23 -10
- sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +110 -222
- sp_api/asyncio/api/messaging/messaging.py +185 -199
- sp_api/asyncio/api/notifications/notifications.py +145 -107
- sp_api/asyncio/api/orders/orders.py +9 -46
- sp_api/asyncio/api/orders/orders_2026_01_01.py +19 -65
- sp_api/asyncio/api/orders/orders_v0.py +152 -184
- sp_api/asyncio/api/product_fees/product_fees.py +101 -75
- sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +47 -36
- sp_api/asyncio/api/products/products.py +94 -387
- sp_api/asyncio/api/products/products_2022_05_01.py +109 -0
- sp_api/asyncio/api/products/products_v0.py +388 -0
- sp_api/asyncio/api/replenishment/replenishment.py +59 -70
- sp_api/asyncio/api/reports/reports.py +124 -157
- sp_api/asyncio/api/sales/sales.py +22 -39
- sp_api/asyncio/api/seller_wallet/__init__.py +0 -0
- sp_api/asyncio/api/seller_wallet/seller_wallet.py +92 -0
- sp_api/asyncio/api/seller_wallet/seller_wallet_2024_03_01.py +301 -0
- sp_api/asyncio/api/sellers/sellers.py +16 -36
- sp_api/asyncio/api/services/services.py +479 -82
- sp_api/asyncio/api/shipment_invoicing/__init__.py +0 -0
- sp_api/asyncio/api/shipment_invoicing/shipment_invoicing.py +92 -0
- sp_api/asyncio/api/shipment_invoicing/shipment_invoicing_v0.py +102 -0
- sp_api/asyncio/api/shipping/shipping.py +94 -441
- sp_api/asyncio/api/shipping/shippingV2.py +181 -472
- sp_api/asyncio/api/shipping/shipping_v1.py +331 -0
- sp_api/asyncio/api/shipping/shipping_v2.py +717 -0
- sp_api/asyncio/api/solicitations/solicitations.py +29 -19
- sp_api/asyncio/api/supply_sources/supply_sources.py +67 -57
- sp_api/asyncio/api/tokens/tokens.py +14 -35
- sp_api/asyncio/api/vehicles/__init__.py +0 -0
- sp_api/asyncio/api/vehicles/vehicles.py +92 -0
- sp_api/asyncio/api/vehicles/vehicles_2024_11_01.py +34 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +16 -29
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +120 -192
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_2021_12_28.py +116 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_v1.py +115 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +15 -225
- sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data.py +92 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.py +51 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +120 -623
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_2021_12_28.py +392 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_v1.py +321 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +112 -29
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_2021_12_28.py +49 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_v1.py +48 -0
- sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +16 -265
- sp_api/asyncio/api/vendor_orders/vendor_orders.py +84 -132
- sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +150 -69
- sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +17 -12
- sp_api/asyncio/base/client.py +2 -2
- sp_api/asyncio/util/load_date_bound.py +1 -1
- sp_api/base/__init__.py +10 -0
- sp_api/base/_core.py +2 -2
- sp_api/base/client.py +3 -3
- sp_api/base/helpers.py +12 -1
- sp_api/base/marketplaces.py +6 -3
- sp_api/util/__init__.py +2 -0
- sp_api/util/load_date_bound.py +1 -1
- sp_api/util/versioned_client.py +45 -0
- python_amazon_sp_api-2.0.15.dist-info/RECORD +0 -255
- sp_api/asyncio/api/models/__init__.py +0 -4
- sp_api/asyncio/api/overrides/__init__.py +0 -1
- {python_amazon_sp_api-2.0.15.data → python_amazon_sp_api-2.1.3.data}/scripts/make_endpoint +0 -0
- {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/WHEEL +0 -0
- {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/top_level.txt +0 -0
|
@@ -16,26 +16,29 @@ class VendorShipments(AsyncBaseClient):
|
|
|
16
16
|
async def submit_shipment_confirmations(self, **kwargs) -> ApiResponse:
|
|
17
17
|
"""
|
|
18
18
|
submit_shipment_confirmations(self, **kwargs) -> ApiResponse
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
Submits one or more shipment confirmations for vendor orders.
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
**Usage Plan:**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
|
|
24
|
+
====================================== ==============
|
|
25
|
+
Rate (requests per second) Burst
|
|
26
|
+
====================================== ==============
|
|
27
|
+
10 10
|
|
28
|
+
====================================== ==============
|
|
29
|
+
|
|
30
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
31
|
+
|
|
32
|
+
Examples:
|
|
33
|
+
literal blocks::
|
|
34
|
+
|
|
35
|
+
await VendorShipments().submit_shipment_confirmations()
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
body: SubmitShipmentConfirmationsRequest | required A request to submit shipment confirmation.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
ApiResponse
|
|
39
42
|
"""
|
|
40
43
|
|
|
41
44
|
return await self._request(kwargs.pop("path"), data=kwargs)
|
|
@@ -44,26 +47,29 @@ class VendorShipments(AsyncBaseClient):
|
|
|
44
47
|
async def submit_shipments(self, **kwargs) -> ApiResponse:
|
|
45
48
|
"""
|
|
46
49
|
submit_shipments(self, **kwargs) -> ApiResponse
|
|
47
|
-
|
|
50
|
+
|
|
48
51
|
Submits one or more shipment request for vendor Orders.
|
|
49
|
-
|
|
52
|
+
|
|
50
53
|
**Usage Plan:**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
|
|
55
|
+
====================================== ==============
|
|
56
|
+
Rate (requests per second) Burst
|
|
57
|
+
====================================== ==============
|
|
58
|
+
10 10
|
|
59
|
+
====================================== ==============
|
|
60
|
+
|
|
61
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
62
|
+
|
|
63
|
+
Examples:
|
|
64
|
+
literal blocks::
|
|
65
|
+
|
|
66
|
+
await VendorShipments().submit_shipments()
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
body: SubmitShipments | required A request to submit shipment request.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
ApiResponse
|
|
67
73
|
"""
|
|
68
74
|
|
|
69
75
|
return await self._request(kwargs.pop("path"), data=kwargs)
|
|
@@ -72,47 +78,122 @@ class VendorShipments(AsyncBaseClient):
|
|
|
72
78
|
async def get_shipment_details(self, **kwargs) -> ApiResponse:
|
|
73
79
|
"""
|
|
74
80
|
get_shipment_details(self, **kwargs) -> ApiResponse
|
|
75
|
-
|
|
81
|
+
|
|
76
82
|
Returns the Details about Shipment, Carrier Details, status of the shipment, container details and other details related to shipment based on the filter parameters value that you specify.
|
|
77
|
-
|
|
83
|
+
|
|
78
84
|
**Usage Plan:**
|
|
85
|
+
|
|
86
|
+
====================================== ==============
|
|
87
|
+
Rate (requests per second) Burst
|
|
88
|
+
====================================== ==============
|
|
89
|
+
10 10
|
|
90
|
+
====================================== ==============
|
|
91
|
+
|
|
92
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
93
|
+
|
|
94
|
+
Examples:
|
|
95
|
+
literal blocks::
|
|
96
|
+
|
|
97
|
+
await VendorShipments().get_shipment_details()
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
key limit: object | The limit to the number of records returned. Default value is 50 records.
|
|
101
|
+
key sortOrder: object | Sort in ascending or descending order by purchase order creation date.
|
|
102
|
+
key nextToken: object | Used for pagination when there are more shipments than the specified result size limit.
|
|
103
|
+
key createdAfter: object | Get Shipment Details that became available after this timestamp will be included in the result. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
104
|
+
key createdBefore: object | Get Shipment Details that became available before this timestamp will be included in the result. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
105
|
+
key shipmentConfirmedBefore: object | Get Shipment Details by passing Shipment confirmed create Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
106
|
+
key shipmentConfirmedAfter: object | Get Shipment Details by passing Shipment confirmed create Date After. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
107
|
+
key packageLabelCreatedBefore: object | Get Shipment Details by passing Package label create Date by buyer. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
108
|
+
key packageLabelCreatedAfter: object | Get Shipment Details by passing Package label create Date After by buyer. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
109
|
+
key shippedBefore: object | Get Shipment Details by passing Shipped Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
110
|
+
key shippedAfter: object | Get Shipment Details by passing Shipped Date After. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
111
|
+
key estimatedDeliveryBefore: object | Get Shipment Details by passing Estimated Delivery Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
112
|
+
key estimatedDeliveryAfter: object | Get Shipment Details by passing Estimated Delivery Date After. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
113
|
+
key shipmentDeliveryBefore: object | Get Shipment Details by passing Shipment Delivery Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
114
|
+
key shipmentDeliveryAfter: object | Get Shipment Details by passing Shipment Delivery Date After. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
115
|
+
key requestedPickUpBefore: object | Get Shipment Details by passing Before Requested pickup date. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
116
|
+
key requestedPickUpAfter: object | Get Shipment Details by passing After Requested pickup date. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
117
|
+
key scheduledPickUpBefore: object | Get Shipment Details by passing Before scheduled pickup date. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
118
|
+
key scheduledPickUpAfter: object | Get Shipment Details by passing After Scheduled pickup date. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
119
|
+
key currentShipmentStatus: object | Get Shipment Details by passing Current shipment status.
|
|
120
|
+
key vendorShipmentIdentifier: object | Get Shipment Details by passing Vendor Shipment ID
|
|
121
|
+
key buyerReferenceNumber: object | Get Shipment Details by passing buyer Reference ID
|
|
122
|
+
key buyerWarehouseCode: object | Get Shipping Details based on buyer warehouse code. This value should be same as 'shipToParty.partyId' in the Shipment.
|
|
123
|
+
key sellerWarehouseCode: object | Get Shipping Details based on vendor warehouse code. This value should be same as 'sellingParty.partyId' in the Shipment.
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
ApiResponse
|
|
127
|
+
"""
|
|
79
128
|
|
|
80
|
-
|
|
81
|
-
| ---- | ---- |
|
|
82
|
-
| 10 | 10 |
|
|
129
|
+
return await self._request(kwargs.pop("path"), params=kwargs)
|
|
83
130
|
|
|
84
|
-
The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
|
|
85
131
|
|
|
132
|
+
@sp_endpoint("/vendor/shipping/v1/shipmentConfirmation", method="POST")
|
|
133
|
+
async def submit_shipment_confirmation(self, **kwargs) -> ApiResponse:
|
|
134
|
+
"""
|
|
135
|
+
submit_shipment_confirmation(self, **kwargs) -> ApiResponse
|
|
136
|
+
|
|
137
|
+
Submits one shipment confirmation for vendor orders and get response immediately.
|
|
138
|
+
|
|
139
|
+
**Usage Plan:**
|
|
140
|
+
|
|
141
|
+
====================================== ==============
|
|
142
|
+
Rate (requests per second) Burst
|
|
143
|
+
====================================== ==============
|
|
144
|
+
10 10
|
|
145
|
+
====================================== ==============
|
|
146
|
+
|
|
147
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
148
|
+
|
|
149
|
+
Examples:
|
|
150
|
+
literal blocks::
|
|
151
|
+
|
|
152
|
+
await VendorShipments().submit_shipment_confirmation()
|
|
153
|
+
|
|
86
154
|
Args:
|
|
155
|
+
body: SubmitShipmentConfirmationRequest | required A request to submit shipment confirmation.
|
|
156
|
+
|
|
157
|
+
Returns:
|
|
158
|
+
ApiResponse
|
|
159
|
+
"""
|
|
160
|
+
return await self._request(kwargs.pop("path"), data=kwargs)
|
|
87
161
|
|
|
88
|
-
key limit:integer | The limit to the number of records returned. Default value is 50 records.
|
|
89
|
-
key sortOrder:string | Sort in ascending or descending order by purchase order creation date.
|
|
90
|
-
key nextToken:string | Used for pagination when there are more shipments than the specified result size limit.
|
|
91
|
-
key createdAfter:string | Get Shipment Details that became available after this timestamp will be included in the result. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
92
|
-
key createdBefore:string | Get Shipment Details that became available before this timestamp will be included in the result. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
93
|
-
key shipmentConfirmedBefore:string | Get Shipment Details by passing Shipment confirmed create Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
94
|
-
key shipmentConfirmedAfter:string | Get Shipment Details by passing Shipment confirmed create Date After. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
95
|
-
key packageLabelCreatedBefore:string | Get Shipment Details by passing Package label create Date by buyer. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
96
|
-
key packageLabelCreatedAfter:string | Get Shipment Details by passing Package label create Date After by buyer. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
97
|
-
key shippedBefore:string | Get Shipment Details by passing Shipped Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
98
|
-
key shippedAfter:string | Get Shipment Details by passing Shipped Date After. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
99
|
-
key estimatedDeliveryBefore:string | Get Shipment Details by passing Estimated Delivery Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
100
|
-
key estimatedDeliveryAfter:string | Get Shipment Details by passing Estimated Delivery Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
101
|
-
key shipmentDeliveryBefore:string | Get Shipment Details by passing Shipment Delivery Date Before. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
102
|
-
key shipmentDeliveryAfter:string | Get Shipment Details by passing Shipment Delivery Date After. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
103
|
-
key requestedPickUpBefore:string | Get Shipment Details by passing Before Requested pickup date. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
104
|
-
key requestedPickUpAfter:string | Get Shipment Details by passing After Requested pickup date. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
105
|
-
key scheduledPickUpBefore:string | Get Shipment Details by passing Before scheduled pickup date. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
106
|
-
key scheduledPickUpAfter:string | Get Shipment Details by passing After Scheduled pickup date. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> format.
|
|
107
|
-
key currentShipmentStatus:string | Get Shipment Details by passing Current shipment status.
|
|
108
|
-
key vendorShipmentIdentifier:string | Get Shipment Details by passing Vendor Shipment ID
|
|
109
|
-
key buyerReferenceNumber:string | Get Shipment Details by passing buyer Reference ID
|
|
110
|
-
key buyerWarehouseCode:string | Get Shipping Details based on buyer warehouse code. This value should be same as 'shipToParty.partyId' in the Shipment.
|
|
111
|
-
key sellerWarehouseCode:string | Get Shipping Details based on vendor warehouse code. This value should be same as 'sellingParty.partyId' in the Shipment.
|
|
112
162
|
|
|
113
163
|
|
|
164
|
+
@sp_endpoint("/vendor/shipping/v1/transportLabels", method="GET")
|
|
165
|
+
async def get_shipment_labels(self, **kwargs) -> ApiResponse:
|
|
166
|
+
"""
|
|
167
|
+
get_shipment_labels(self, **kwargs) -> ApiResponse
|
|
168
|
+
|
|
169
|
+
Returns small parcel shipment labels based on the filters that you specify.
|
|
170
|
+
|
|
171
|
+
**Usage Plan:**
|
|
172
|
+
|
|
173
|
+
====================================== ==============
|
|
174
|
+
Rate (requests per second) Burst
|
|
175
|
+
====================================== ==============
|
|
176
|
+
10 10
|
|
177
|
+
====================================== ==============
|
|
178
|
+
|
|
179
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
180
|
+
|
|
181
|
+
Examples:
|
|
182
|
+
literal blocks::
|
|
183
|
+
|
|
184
|
+
await VendorShipments().get_shipment_labels()
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
key limit: object | The limit to the number of records returned. Default value is 50 records.
|
|
188
|
+
key sortOrder: object | Sort the list by shipment label creation date in ascending or descending order.
|
|
189
|
+
key nextToken: object | A token that you use to retrieve the next page of results. The response includes `nextToken` when the number of results exceeds the specified `pageSize` value. To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until `nextToken` is null. Note that this operation can return empty pages.
|
|
190
|
+
key labelCreatedAfter: object | Shipment labels created after this time will be included in the result. This field must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) datetime format.
|
|
191
|
+
key labelCreatedBefore: object | Shipment labels created before this time will be included in the result. This field must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) datetime format.
|
|
192
|
+
key buyerReferenceNumber: object | Get Shipment labels by passing buyer reference number.
|
|
193
|
+
key vendorShipmentIdentifier: object | Get Shipment labels by passing vendor shipment identifier.
|
|
194
|
+
key sellerWarehouseCode: object | Get Shipping labels based on vendor warehouse code. This value must be same as the `sellingParty.partyId` in the shipment.
|
|
195
|
+
|
|
114
196
|
Returns:
|
|
115
|
-
ApiResponse
|
|
197
|
+
ApiResponse
|
|
116
198
|
"""
|
|
117
|
-
|
|
118
|
-
return await self._request(kwargs.pop("path"), params=kwargs)
|
|
199
|
+
return await self._request(kwargs.pop("path"), params=kwargs)
|
|
@@ -16,26 +16,31 @@ class VendorTransactionStatus(AsyncBaseClient):
|
|
|
16
16
|
async def get_transaction(self, transactionId, **kwargs) -> ApiResponse:
|
|
17
17
|
"""
|
|
18
18
|
get_transaction(self, transactionId, **kwargs) -> ApiResponse
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
Returns the status of the transaction that you specify.
|
|
21
|
-
|
|
22
|
-
**Usage
|
|
23
|
-
|
|
21
|
+
|
|
22
|
+
**Usage Plan:**
|
|
23
|
+
|
|
24
24
|
====================================== ==============
|
|
25
25
|
Rate (requests per second) Burst
|
|
26
26
|
====================================== ==============
|
|
27
|
-
10
|
|
27
|
+
10 20
|
|
28
28
|
====================================== ==============
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
|
|
30
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
31
|
+
|
|
32
|
+
Examples:
|
|
33
|
+
literal blocks::
|
|
34
|
+
|
|
35
|
+
await VendorTransactionStatus().get_transaction("value")
|
|
36
|
+
|
|
32
37
|
Args:
|
|
33
|
-
transactionId:
|
|
34
|
-
|
|
38
|
+
transactionId: object | required The GUID provided by Amazon in the 'transactionId' field in response to the post request of a specific transaction.
|
|
39
|
+
|
|
35
40
|
Returns:
|
|
36
|
-
ApiResponse
|
|
41
|
+
ApiResponse
|
|
37
42
|
"""
|
|
38
43
|
|
|
39
44
|
return await self._request(
|
|
40
45
|
fill_query_params(kwargs.pop("path"), transactionId), params=kwargs
|
|
41
|
-
)
|
|
46
|
+
)
|
sp_api/asyncio/base/client.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from datetime import datetime
|
|
1
|
+
from datetime import datetime, timezone
|
|
2
2
|
import logging
|
|
3
3
|
import os
|
|
4
4
|
|
|
@@ -75,7 +75,7 @@ class Client(BaseClient):
|
|
|
75
75
|
"host": self.endpoint[8:],
|
|
76
76
|
"user-agent": self.user_agent,
|
|
77
77
|
"x-amz-access-token": token,
|
|
78
|
-
"x-amz-date": datetime.
|
|
78
|
+
"x-amz-date": datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ"),
|
|
79
79
|
"content-type": "application/json",
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -21,7 +21,7 @@ def load_date_bound(interval_days: int = 30):
|
|
|
21
21
|
{
|
|
22
22
|
"dataStartTime": parse_if_needed(kwargs["dataStartTime"]),
|
|
23
23
|
"dataEndTime": parse_if_needed(
|
|
24
|
-
kwargs.get("dataEndTime", datetime.datetime.
|
|
24
|
+
kwargs.get("dataEndTime", datetime.datetime.now(datetime.timezone.utc))
|
|
25
25
|
),
|
|
26
26
|
}
|
|
27
27
|
)
|
sp_api/base/__init__.py
CHANGED
|
@@ -23,6 +23,8 @@ from .schedules import Schedules
|
|
|
23
23
|
from .report_status import ReportStatus
|
|
24
24
|
from .sales_enum import FirstDayOfWeek, Granularity, BuyerType
|
|
25
25
|
from .fulfillment_channel import FulfillmentChannel
|
|
26
|
+
from .identifiersType import IdentifiersType
|
|
27
|
+
from .InventoryEnums import InventoryGranularity
|
|
26
28
|
from .included_data import (
|
|
27
29
|
IncludedData,
|
|
28
30
|
ListingItemsIncludedData,
|
|
@@ -46,6 +48,7 @@ __all__ = [
|
|
|
46
48
|
"AccessTokenClient",
|
|
47
49
|
"ReportType",
|
|
48
50
|
"FeedType",
|
|
51
|
+
"FeedTypes",
|
|
49
52
|
"ProcessingStatus",
|
|
50
53
|
"ApiResponse",
|
|
51
54
|
"Client",
|
|
@@ -70,6 +73,9 @@ __all__ = [
|
|
|
70
73
|
"Granularity",
|
|
71
74
|
"BuyerType",
|
|
72
75
|
"FulfillmentChannel",
|
|
76
|
+
"FulfillmentChannels",
|
|
77
|
+
"IdentifiersType",
|
|
78
|
+
"InventoryGranularity",
|
|
73
79
|
"deprecated",
|
|
74
80
|
"NotificationType",
|
|
75
81
|
"CredentialProvider",
|
|
@@ -82,3 +88,7 @@ __all__ = [
|
|
|
82
88
|
"CatalogItemsIncludedData",
|
|
83
89
|
"AwsEnv",
|
|
84
90
|
]
|
|
91
|
+
|
|
92
|
+
# Backward-compatibility aliases for docs and legacy imports.
|
|
93
|
+
FeedTypes = FeedType
|
|
94
|
+
FulfillmentChannels = FulfillmentChannel
|
sp_api/base/_core.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from datetime import datetime
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
3
|
from json import JSONDecodeError
|
|
4
4
|
|
|
5
5
|
from .ApiResponse import ApiResponse
|
|
@@ -52,7 +52,7 @@ def build_headers(endpoint, user_agent, access_token, content_type="application/
|
|
|
52
52
|
"host": endpoint[8:],
|
|
53
53
|
"user-agent": user_agent,
|
|
54
54
|
"x-amz-access-token": access_token,
|
|
55
|
-
"x-amz-date": datetime.
|
|
55
|
+
"x-amz-date": datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ"),
|
|
56
56
|
"content-type": content_type,
|
|
57
57
|
}
|
|
58
58
|
|
sp_api/base/client.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from datetime import datetime
|
|
1
|
+
from datetime import datetime, timezone
|
|
2
2
|
import logging
|
|
3
3
|
import os
|
|
4
4
|
|
|
@@ -72,7 +72,7 @@ class Client(BaseClient):
|
|
|
72
72
|
"host": self.endpoint[8:],
|
|
73
73
|
"user-agent": self.user_agent,
|
|
74
74
|
"x-amz-access-token": self.restricted_data_token or self.auth.access_token,
|
|
75
|
-
"x-amz-date": datetime.
|
|
75
|
+
"x-amz-date": datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ"),
|
|
76
76
|
"content-type": "application/json",
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -179,7 +179,7 @@ class Client(BaseClient):
|
|
|
179
179
|
"host": self.endpoint[8:],
|
|
180
180
|
"user-agent": self.user_agent,
|
|
181
181
|
"x-amz-access-token": self.grantless_auth.access_token,
|
|
182
|
-
"x-amz-date": datetime.
|
|
182
|
+
"x-amz-date": datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ"),
|
|
183
183
|
"content-type": "application/json",
|
|
184
184
|
}
|
|
185
185
|
log.debug("HTTP Method: %s", self.method)
|
sp_api/base/helpers.py
CHANGED
|
@@ -7,7 +7,18 @@ from urllib import parse
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def fill_query_params(query, *args):
|
|
10
|
-
|
|
10
|
+
quoted = [parse.quote(str(arg), safe="") for arg in args]
|
|
11
|
+
try:
|
|
12
|
+
return query.format(*quoted)
|
|
13
|
+
except KeyError:
|
|
14
|
+
import string
|
|
15
|
+
|
|
16
|
+
formatter = string.Formatter()
|
|
17
|
+
fields = [field_name for _, field_name, _, _ in formatter.parse(query) if field_name]
|
|
18
|
+
if fields and len(fields) == len(quoted):
|
|
19
|
+
mapping = dict(zip(fields, quoted))
|
|
20
|
+
return query.format_map(mapping)
|
|
21
|
+
raise
|
|
11
22
|
|
|
12
23
|
|
|
13
24
|
def sp_endpoint(path, method="GET"):
|
sp_api/base/marketplaces.py
CHANGED
|
@@ -49,9 +49,12 @@ if AwsEnv(AWS_ENVIRONMENT) == AwsEnv.SANDBOX:
|
|
|
49
49
|
|
|
50
50
|
class Marketplaces(Enum):
|
|
51
51
|
"""Enumeration for MWS marketplaces, containing endpoints and marketplace IDs.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
|
|
53
|
+
Examples:
|
|
54
|
+
literal blocks::
|
|
55
|
+
|
|
56
|
+
endpoint = Marketplaces.UK.endpoint
|
|
57
|
+
marketplace_id = Marketplaces.UK.marketplace_id
|
|
55
58
|
"""
|
|
56
59
|
|
|
57
60
|
#: Amazon marketplace in United Arab Emirates (AE)
|
sp_api/util/__init__.py
CHANGED
|
@@ -22,6 +22,7 @@ from .products_definitions import (
|
|
|
22
22
|
CompetitiveSummaryRequest,
|
|
23
23
|
GetCompetitiveSummaryBatch,
|
|
24
24
|
)
|
|
25
|
+
from .versioned_client import VersionedClientMeta
|
|
25
26
|
|
|
26
27
|
__all__ = [
|
|
27
28
|
"retry",
|
|
@@ -46,4 +47,5 @@ __all__ = [
|
|
|
46
47
|
"GetFeaturedOfferExpectedPriceBatch",
|
|
47
48
|
"CompetitiveSummaryRequest",
|
|
48
49
|
"GetCompetitiveSummaryBatch",
|
|
50
|
+
"VersionedClientMeta",
|
|
49
51
|
]
|
sp_api/util/load_date_bound.py
CHANGED
|
@@ -21,7 +21,7 @@ def load_date_bound(interval_days: int = 30):
|
|
|
21
21
|
{
|
|
22
22
|
"dataStartTime": parse_if_needed(kwargs["dataStartTime"]),
|
|
23
23
|
"dataEndTime": parse_if_needed(
|
|
24
|
-
kwargs.get("dataEndTime", datetime.datetime.
|
|
24
|
+
kwargs.get("dataEndTime", datetime.datetime.now(datetime.timezone.utc))
|
|
25
25
|
),
|
|
26
26
|
}
|
|
27
27
|
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class VersionedClientMeta(type):
|
|
7
|
+
"""Metaclass that dispatches construction to a version-specific implementation.
|
|
8
|
+
|
|
9
|
+
This keeps the call-site ergonomic (`Client(version=...)`) while allowing a single
|
|
10
|
+
place to implement the dispatch logic.
|
|
11
|
+
|
|
12
|
+
Subclasses should define:
|
|
13
|
+
- `_VERSION_MAP`: mapping of normalized version strings to implementation classes
|
|
14
|
+
- `_VERSION_ALIASES` (optional): mapping of alias strings to normalized versions
|
|
15
|
+
- `_DEFAULT_VERSION`: default version when none is provided
|
|
16
|
+
|
|
17
|
+
Front classes must set `_DISPATCH = True` in their class body.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __call__(cls, *args: Any, **kwargs: Any):
|
|
21
|
+
version = kwargs.pop("version", None)
|
|
22
|
+
|
|
23
|
+
# Only dispatch for the public front class itself.
|
|
24
|
+
if cls.__dict__.get("_DISPATCH", False):
|
|
25
|
+
# Backwards-compatible default: if no version is provided, return the
|
|
26
|
+
# oldest supported implementation.
|
|
27
|
+
v_raw = version if version is not None else getattr(cls, "_DEFAULT_VERSION", None)
|
|
28
|
+
if v_raw is None:
|
|
29
|
+
return super().__call__(*args, **kwargs)
|
|
30
|
+
|
|
31
|
+
v_raw = getattr(v_raw, "value", v_raw)
|
|
32
|
+
v = str(v_raw)
|
|
33
|
+
aliases: dict[str, str] = getattr(cls, "_VERSION_ALIASES", {})
|
|
34
|
+
v_norm = aliases.get(v, v)
|
|
35
|
+
|
|
36
|
+
impl_map: dict[str, type] = getattr(cls, "_VERSION_MAP", {})
|
|
37
|
+
impl = impl_map.get(v_norm)
|
|
38
|
+
if impl is not None:
|
|
39
|
+
kwargs["version"] = v_norm
|
|
40
|
+
return impl(*args, **kwargs)
|
|
41
|
+
|
|
42
|
+
supported = ", ".join(sorted(impl_map.keys()))
|
|
43
|
+
raise ValueError(f"Unsupported version {v!r}. Supported: {supported}")
|
|
44
|
+
|
|
45
|
+
return super().__call__(*args, **kwargs)
|