python-amazon-sp-api 1.9.18__py3-none-any.whl → 2.0.7__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-1.9.18.data → python_amazon_sp_api-2.0.7.data}/scripts/make_endpoint +2 -2
- {python_amazon_sp_api-1.9.18.dist-info → python_amazon_sp_api-2.0.7.dist-info}/METADATA +46 -23
- python_amazon_sp_api-2.0.7.dist-info/RECORD +251 -0
- {python_amazon_sp_api-1.9.18.dist-info → python_amazon_sp_api-2.0.7.dist-info}/WHEEL +1 -1
- {python_amazon_sp_api-1.9.18.dist-info → python_amazon_sp_api-2.0.7.dist-info}/top_level.txt +0 -1
- sp_api/__version__.py +1 -1
- sp_api/api/__init__.py +18 -1
- sp_api/api/application_integrations/application_integrations.py +118 -0
- sp_api/api/application_management/application_management.py +2 -1
- sp_api/api/catalog/catalog.py +3 -4
- sp_api/api/catalog_items/catalog_items.py +3 -6
- sp_api/api/customer_feedback/customer_feedback.py +110 -0
- sp_api/api/data_kiosk/data_kiosk.py +5 -6
- sp_api/api/easy_ship/easy_ship.py +190 -0
- sp_api/api/external_fulfillment/external_fulfillment.py +706 -0
- sp_api/api/feeds/feeds.py +11 -8
- sp_api/api/finances/finances.py +30 -4
- sp_api/api/fulfillment_inbound/fulfillment_inbound.py +35 -2
- sp_api/api/inventories/inventories.py +2 -7
- sp_api/api/listings_items/listings_items.py +3 -24
- sp_api/api/messaging/messaging.py +42 -0
- sp_api/api/orders/orders.py +7 -0
- sp_api/api/product_fees/product_fees.py +31 -74
- sp_api/api/products/products.py +80 -2
- sp_api/api/products/products_definitions.py +11 -85
- sp_api/api/reports/reports.py +65 -97
- sp_api/api/sales/sales.py +2 -2
- sp_api/asyncio/api/__init__.py +164 -0
- sp_api/asyncio/api/amazon_warehousing_and_distribu/__init__.py +9 -0
- sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +130 -0
- sp_api/asyncio/api/aplus_content/__init__.py +5 -0
- sp_api/asyncio/api/aplus_content/aplus_content.py +330 -0
- sp_api/asyncio/api/application_integrations/__init__.py +5 -0
- sp_api/asyncio/api/application_integrations/application_integrations.py +119 -0
- sp_api/asyncio/api/application_management/__init__.py +5 -0
- sp_api/asyncio/api/application_management/application_management.py +36 -0
- sp_api/asyncio/api/authorization/__init__.py +5 -0
- sp_api/asyncio/api/authorization/authorization.py +54 -0
- sp_api/asyncio/api/catalog/__init__.py +5 -0
- sp_api/asyncio/api/catalog/catalog.py +111 -0
- sp_api/asyncio/api/catalog_items/__init__.py +6 -0
- sp_api/asyncio/api/catalog_items/catalog_items.py +93 -0
- sp_api/asyncio/api/clients/__init__.py +1 -0
- sp_api/asyncio/api/customer_feedback/__init__.py +5 -0
- sp_api/asyncio/api/customer_feedback/customer_feedback.py +111 -0
- sp_api/asyncio/api/data_kiosk/__init__.py +5 -0
- sp_api/asyncio/api/data_kiosk/data_kiosk.py +236 -0
- sp_api/asyncio/api/easy_ship/__init__.py +5 -0
- sp_api/asyncio/api/easy_ship/easy_ship.py +191 -0
- sp_api/asyncio/api/external_fulfillment/__init__.py +5 -0
- sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +706 -0
- sp_api/asyncio/api/fba_inbound_eligibility/__init__.py +5 -0
- sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +96 -0
- sp_api/asyncio/api/fba_small_and_light/__init__.py +5 -0
- sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +213 -0
- sp_api/asyncio/api/feeds/feeds.py +260 -0
- sp_api/asyncio/api/finances/finances.py +100 -0
- sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +1798 -0
- sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +736 -0
- sp_api/asyncio/api/inventories/inventories.py +74 -0
- sp_api/asyncio/api/listings_items/__init__.py +0 -0
- sp_api/asyncio/api/listings_items/listings_items.py +170 -0
- sp_api/asyncio/api/listings_restrictions/__init__.py +0 -0
- sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +36 -0
- sp_api/asyncio/api/merchant_fulfillment/__init__.py +0 -0
- sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +384 -0
- sp_api/asyncio/api/messaging/__init__.py +0 -0
- sp_api/asyncio/api/messaging/messaging.py +511 -0
- sp_api/asyncio/api/models/__init__.py +4 -0
- sp_api/asyncio/api/notifications/__init__.py +0 -0
- sp_api/asyncio/api/notifications/notifications.py +295 -0
- sp_api/asyncio/api/orders/__init__.py +0 -0
- sp_api/asyncio/api/orders/orders.py +362 -0
- sp_api/asyncio/api/overrides/__init__.py +1 -0
- sp_api/asyncio/api/product_fees/__init__.py +0 -0
- sp_api/asyncio/api/product_fees/product_fees.py +194 -0
- sp_api/asyncio/api/product_type_definitions/__init__.py +0 -0
- sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +75 -0
- sp_api/asyncio/api/products/__init__.py +0 -0
- sp_api/asyncio/api/products/products.py +405 -0
- sp_api/asyncio/api/products/products_definitions.py +11 -0
- sp_api/asyncio/api/replenishment/__init__.py +0 -0
- sp_api/asyncio/api/replenishment/replenishment.py +121 -0
- sp_api/asyncio/api/reports/__init__.py +0 -0
- sp_api/asyncio/api/reports/reports.py +439 -0
- sp_api/asyncio/api/sales/__init__.py +0 -0
- sp_api/asyncio/api/sales/sales.py +93 -0
- sp_api/asyncio/api/sellers/__init__.py +0 -0
- sp_api/asyncio/api/sellers/sellers.py +70 -0
- sp_api/asyncio/api/services/__init__.py +0 -0
- sp_api/asyncio/api/services/services.py +218 -0
- sp_api/asyncio/api/shipping/__init__.py +0 -0
- sp_api/asyncio/api/shipping/shipping.py +459 -0
- sp_api/asyncio/api/shipping/shippingV2.py +651 -0
- sp_api/asyncio/api/solicitations/__init__.py +0 -0
- sp_api/asyncio/api/solicitations/solicitations.py +78 -0
- sp_api/asyncio/api/supply_sources/__init__.py +0 -0
- sp_api/asyncio/api/supply_sources/supply_sources.py +138 -0
- sp_api/asyncio/api/tokens/__init__.py +0 -0
- sp_api/asyncio/api/tokens/tokens.py +65 -0
- sp_api/asyncio/api/upload/__init__.py +0 -0
- sp_api/asyncio/api/upload/upload.py +18 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_inventory/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +64 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +196 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_payments/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +254 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +627 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/__init__.py +0 -0
- sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +43 -0
- sp_api/asyncio/api/vendor_invoices/__init__.py +0 -0
- sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +295 -0
- sp_api/asyncio/api/vendor_orders/__init__.py +0 -0
- sp_api/asyncio/api/vendor_orders/vendor_orders.py +210 -0
- sp_api/asyncio/api/vendor_shipments/__init__.py +0 -0
- sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +118 -0
- sp_api/asyncio/api/vendor_transaction_status/__init__.py +0 -0
- sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +41 -0
- sp_api/asyncio/auth/__init__.py +12 -0
- sp_api/asyncio/auth/access_token_client.py +145 -0
- sp_api/asyncio/auth/exceptions.py +5 -0
- sp_api/asyncio/base/__init__.py +53 -0
- sp_api/asyncio/base/_transport_httpx.py +50 -0
- sp_api/asyncio/base/base_client.py +8 -0
- sp_api/asyncio/base/client.py +169 -0
- sp_api/asyncio/util/__init__.py +29 -0
- sp_api/asyncio/util/key_maker.py +5 -0
- sp_api/asyncio/util/load_all_pages.py +55 -0
- sp_api/asyncio/util/load_date_bound.py +53 -0
- sp_api/asyncio/util/retry.py +88 -0
- sp_api/auth/_core.py +39 -0
- sp_api/auth/access_token_client.py +18 -29
- sp_api/base/ApiResponse.py +3 -2
- sp_api/base/_core.py +110 -0
- sp_api/base/_transport_httpx.py +39 -0
- sp_api/base/client.py +40 -63
- sp_api/base/helpers.py +1 -1
- sp_api/base/reportTypes.py +3 -2
- sp_api/util/__init__.py +36 -0
- sp_api/util/load_all_pages.py +2 -1
- sp_api/util/params.py +57 -0
- sp_api/util/product_fees.py +40 -0
- sp_api/util/products_definitions.py +169 -0
- sp_api/util/report_document.py +154 -0
- python_amazon_sp_api-1.9.18.dist-info/RECORD +0 -144
- tests/api/finances/test_finances.py +0 -19
- tests/api/notifications/test_notifications.py +0 -26
- tests/api/orders/test_orders.py +0 -122
- tests/api/product_fees/product_fees.py +0 -49
- tests/api/reports/test_reports.py +0 -127
- tests/client/test_auth.py +0 -59
- tests/client/test_base.py +0 -163
- tests/client/test_credential_provider.py +0 -45
- tests/client/test_helpers.py +0 -142
- {python_amazon_sp_api-1.9.18.dist-info → python_amazon_sp_api-2.0.7.dist-info/licenses}/LICENSE +0 -0
- {tests → sp_api/api/application_integrations}/__init__.py +0 -0
- {tests/api → sp_api/api/customer_feedback}/__init__.py +0 -0
- {tests/api/finances → sp_api/api/easy_ship}/__init__.py +0 -0
- {tests/api/notifications → sp_api/api/external_fulfillment}/__init__.py +0 -0
- {tests/api/orders → sp_api/asyncio}/__init__.py +0 -0
- {tests/api/product_fees → sp_api/asyncio/api/feeds}/__init__.py +0 -0
- {tests/api/reports → sp_api/asyncio/api/finances}/__init__.py +0 -0
- {tests/api/sellers → sp_api/asyncio/api/fulfillment_inbound}/__init__.py +0 -0
- {tests/client → sp_api/asyncio/api/fulfillment_outbound}/__init__.py +0 -0
- /tests/api/sellers/test_sellers.py → /sp_api/asyncio/api/inventories/__init__.py +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
def create_fees_body(
|
|
2
|
+
*,
|
|
3
|
+
price,
|
|
4
|
+
shipping_price=None,
|
|
5
|
+
currency="USD",
|
|
6
|
+
is_fba=False,
|
|
7
|
+
identifier=None,
|
|
8
|
+
points=None,
|
|
9
|
+
marketplace_id=None,
|
|
10
|
+
optional_fulfillment_program=None,
|
|
11
|
+
id_type=None,
|
|
12
|
+
id_value=None,
|
|
13
|
+
):
|
|
14
|
+
body = {
|
|
15
|
+
"FeesEstimateRequest": {
|
|
16
|
+
"Identifier": identifier or str(price),
|
|
17
|
+
"PriceToEstimateFees": {
|
|
18
|
+
"ListingPrice": {"Amount": price, "CurrencyCode": currency},
|
|
19
|
+
"Shipping": (
|
|
20
|
+
{"Amount": shipping_price, "CurrencyCode": currency}
|
|
21
|
+
if shipping_price
|
|
22
|
+
else None
|
|
23
|
+
),
|
|
24
|
+
"Points": points or None,
|
|
25
|
+
},
|
|
26
|
+
"IsAmazonFulfilled": is_fba,
|
|
27
|
+
"OptionalFulfillmentProgram": (
|
|
28
|
+
optional_fulfillment_program
|
|
29
|
+
if is_fba is True and optional_fulfillment_program
|
|
30
|
+
else None
|
|
31
|
+
),
|
|
32
|
+
"MarketplaceId": marketplace_id,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if id_type and id_value:
|
|
37
|
+
body["IdType"] = id_type
|
|
38
|
+
body["IdValue"] = id_value
|
|
39
|
+
|
|
40
|
+
return body
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Optional, List, Dict, Union
|
|
3
|
+
from dataclasses import dataclass, asdict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CompetitiveSummaryIncludedData(Enum):
|
|
7
|
+
FEATURED_BUYING_OPTIONS = "featuredBuyingOptions"
|
|
8
|
+
LOWEST_PRICED_OFFERS = "lowestPricedOffers"
|
|
9
|
+
REFERENCE_PRICES = "referencePrices"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class ItemOffersRequest:
|
|
14
|
+
"""Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
15
|
+
#itemoffersrequest"""
|
|
16
|
+
|
|
17
|
+
uri: str
|
|
18
|
+
method: str
|
|
19
|
+
MarketplaceId: str
|
|
20
|
+
ItemCondition: str = None
|
|
21
|
+
CustomerType: str = None
|
|
22
|
+
headers: Dict = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class GetItemOffersBatchRequest:
|
|
27
|
+
"""Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
28
|
+
#getitemoffersbatchrequest"""
|
|
29
|
+
|
|
30
|
+
requests: Optional[List[Union[ItemOffersRequest, Dict]]] = None
|
|
31
|
+
|
|
32
|
+
def __post_init__(self):
|
|
33
|
+
self.requests = self.parse_requests(self.requests)
|
|
34
|
+
|
|
35
|
+
def to_dict(self):
|
|
36
|
+
return asdict(self)
|
|
37
|
+
|
|
38
|
+
@staticmethod
|
|
39
|
+
def parse_requests(requests) -> List[ItemOffersRequest]:
|
|
40
|
+
parsed_requestes = []
|
|
41
|
+
|
|
42
|
+
for request in requests:
|
|
43
|
+
if isinstance(request, Dict):
|
|
44
|
+
request = ItemOffersRequest(**request)
|
|
45
|
+
|
|
46
|
+
if not isinstance(request, ItemOffersRequest):
|
|
47
|
+
raise TypeError
|
|
48
|
+
|
|
49
|
+
parsed_requestes.append(request)
|
|
50
|
+
|
|
51
|
+
return parsed_requestes
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass
|
|
55
|
+
class ListingOffersRequest:
|
|
56
|
+
"""Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
57
|
+
#listingoffersrequest"""
|
|
58
|
+
|
|
59
|
+
uri: str
|
|
60
|
+
MarketplaceId: str
|
|
61
|
+
ItemCondition: str
|
|
62
|
+
method: str = "GET"
|
|
63
|
+
CustomerType: str = "Consumer"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@dataclass
|
|
67
|
+
class GetListingOffersBatchRequest:
|
|
68
|
+
"""Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v0-reference
|
|
69
|
+
#getlistingoffersbatchrequest"""
|
|
70
|
+
|
|
71
|
+
requests: Optional[List[Union[ListingOffersRequest, Dict]]] = None
|
|
72
|
+
|
|
73
|
+
def __post_init__(self):
|
|
74
|
+
self.requests = self.parse_requests(self.requests)
|
|
75
|
+
|
|
76
|
+
def to_dict(self):
|
|
77
|
+
return asdict(self)
|
|
78
|
+
|
|
79
|
+
@staticmethod
|
|
80
|
+
def parse_requests(requests) -> List[ListingOffersRequest]:
|
|
81
|
+
parsed_requestes = []
|
|
82
|
+
|
|
83
|
+
for request in requests:
|
|
84
|
+
if isinstance(request, Dict):
|
|
85
|
+
request = ListingOffersRequest(**request)
|
|
86
|
+
|
|
87
|
+
if not isinstance(request, ListingOffersRequest):
|
|
88
|
+
raise TypeError
|
|
89
|
+
|
|
90
|
+
parsed_requestes.append(request)
|
|
91
|
+
|
|
92
|
+
return parsed_requestes
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass
|
|
96
|
+
class FeaturedOfferExpectedPriceRequest:
|
|
97
|
+
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
98
|
+
#FeaturedOfferExpectedPriceRequest """
|
|
99
|
+
marketplaceId: str
|
|
100
|
+
sku: str
|
|
101
|
+
uri: str = "/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"
|
|
102
|
+
method: str = "GET"
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@dataclass
|
|
106
|
+
class GetFeaturedOfferExpectedPriceBatch:
|
|
107
|
+
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
108
|
+
#getFeaturedOfferExpectedPriceBatch """
|
|
109
|
+
requests: Optional[List[Union[FeaturedOfferExpectedPriceRequest, Dict]]] = None
|
|
110
|
+
|
|
111
|
+
def __post_init__(self):
|
|
112
|
+
self.requests = self.parse_requests(self.requests)
|
|
113
|
+
|
|
114
|
+
def to_dict(self):
|
|
115
|
+
return asdict(self)
|
|
116
|
+
|
|
117
|
+
@staticmethod
|
|
118
|
+
def parse_requests(requests) -> List[FeaturedOfferExpectedPriceRequest]:
|
|
119
|
+
parsed_requests = []
|
|
120
|
+
|
|
121
|
+
for request in requests:
|
|
122
|
+
if isinstance(request, Dict):
|
|
123
|
+
request = FeaturedOfferExpectedPriceRequest(**request)
|
|
124
|
+
|
|
125
|
+
if not isinstance(request, FeaturedOfferExpectedPriceRequest):
|
|
126
|
+
raise TypeError
|
|
127
|
+
|
|
128
|
+
parsed_requests.append(request)
|
|
129
|
+
|
|
130
|
+
return parsed_requests
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@dataclass
|
|
134
|
+
class CompetitiveSummaryRequest:
|
|
135
|
+
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
136
|
+
#FeaturedOfferExpectedPriceRequest """
|
|
137
|
+
marketplaceId: str
|
|
138
|
+
asin: str
|
|
139
|
+
includedData: List[CompetitiveSummaryIncludedData]
|
|
140
|
+
uri: str = "/products/pricing/2022-05-01/items/competitiveSummary"
|
|
141
|
+
method: str = "GET"
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
@dataclass
|
|
145
|
+
class GetCompetitiveSummaryBatch:
|
|
146
|
+
""" Implements definition: https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-reference
|
|
147
|
+
#getCompetitiveSummary """
|
|
148
|
+
requests: Optional[List[Union[CompetitiveSummaryRequest, Dict]]] = None
|
|
149
|
+
|
|
150
|
+
def __post_init__(self):
|
|
151
|
+
self.requests = self.parse_requests(self.requests)
|
|
152
|
+
|
|
153
|
+
def to_dict(self):
|
|
154
|
+
return asdict(self)
|
|
155
|
+
|
|
156
|
+
@staticmethod
|
|
157
|
+
def parse_requests(requests) -> List[CompetitiveSummaryRequest]:
|
|
158
|
+
parsed_requests = []
|
|
159
|
+
|
|
160
|
+
for request in requests:
|
|
161
|
+
if isinstance(request, Dict):
|
|
162
|
+
request = CompetitiveSummaryRequest(**request)
|
|
163
|
+
|
|
164
|
+
if not isinstance(request, CompetitiveSummaryRequest):
|
|
165
|
+
raise TypeError
|
|
166
|
+
|
|
167
|
+
parsed_requests.append(request)
|
|
168
|
+
|
|
169
|
+
return parsed_requests
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import codecs
|
|
2
|
+
import zlib
|
|
3
|
+
from io import BytesIO, StringIO
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def resolve_character_code(response_encoding, fallback="iso-8859-1"):
|
|
7
|
+
character_code = response_encoding or fallback
|
|
8
|
+
if character_code and character_code.lower() == "windows-31j":
|
|
9
|
+
character_code = "cp932"
|
|
10
|
+
return character_code
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def decompress_bytes(document, compression_algorithm):
|
|
14
|
+
if compression_algorithm:
|
|
15
|
+
return zlib.decompress(bytearray(document), 15 + 32)
|
|
16
|
+
return document
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def decode_document(document, character_code):
|
|
20
|
+
if character_code:
|
|
21
|
+
try:
|
|
22
|
+
return document.decode(character_code)
|
|
23
|
+
except Exception:
|
|
24
|
+
return document
|
|
25
|
+
return document
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def handle_file(file, document, encoding):
|
|
29
|
+
if isinstance(file, str):
|
|
30
|
+
with open(file, "w+", encoding=encoding) as text_file:
|
|
31
|
+
text_file.write(document)
|
|
32
|
+
elif isinstance(file, BytesIO):
|
|
33
|
+
file.write(document.encode(encoding))
|
|
34
|
+
file.seek(0)
|
|
35
|
+
elif isinstance(file, StringIO):
|
|
36
|
+
file.write(document)
|
|
37
|
+
file.seek(0)
|
|
38
|
+
else:
|
|
39
|
+
file.write(document)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _open_stream_target(file, encoding):
|
|
43
|
+
if isinstance(file, str):
|
|
44
|
+
return open(file, "w+", encoding=encoding), True, True
|
|
45
|
+
if isinstance(file, StringIO):
|
|
46
|
+
return file, True, False
|
|
47
|
+
if isinstance(file, BytesIO):
|
|
48
|
+
return file, False, False
|
|
49
|
+
if hasattr(file, "mode") and "b" in file.mode:
|
|
50
|
+
return file, False, False
|
|
51
|
+
return file, True, False
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _stream_bytes_to_target_sync(
|
|
55
|
+
chunk_iter, file, encoding, compression_algorithm, close_after
|
|
56
|
+
):
|
|
57
|
+
decompressor = zlib.decompressobj(15 + 32) if compression_algorithm else None
|
|
58
|
+
target, is_text, should_close = file
|
|
59
|
+
decoder = (
|
|
60
|
+
codecs.getincrementaldecoder(encoding)(errors="replace") if is_text else None
|
|
61
|
+
)
|
|
62
|
+
try:
|
|
63
|
+
for chunk in chunk_iter:
|
|
64
|
+
if decompressor:
|
|
65
|
+
chunk = decompressor.decompress(chunk)
|
|
66
|
+
if decoder:
|
|
67
|
+
text = decoder.decode(chunk)
|
|
68
|
+
if text:
|
|
69
|
+
target.write(text)
|
|
70
|
+
else:
|
|
71
|
+
target.write(chunk)
|
|
72
|
+
if decompressor:
|
|
73
|
+
remainder = decompressor.flush()
|
|
74
|
+
if remainder:
|
|
75
|
+
if decoder:
|
|
76
|
+
text = decoder.decode(remainder)
|
|
77
|
+
if text:
|
|
78
|
+
target.write(text)
|
|
79
|
+
else:
|
|
80
|
+
target.write(remainder)
|
|
81
|
+
if decoder:
|
|
82
|
+
tail = decoder.decode(b"", final=True)
|
|
83
|
+
if tail:
|
|
84
|
+
target.write(tail)
|
|
85
|
+
finally:
|
|
86
|
+
if close_after and should_close:
|
|
87
|
+
target.close()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
async def _stream_bytes_to_target_async(
|
|
91
|
+
chunk_iter, file, encoding, compression_algorithm, close_after
|
|
92
|
+
):
|
|
93
|
+
decompressor = zlib.decompressobj(15 + 32) if compression_algorithm else None
|
|
94
|
+
target, is_text, should_close = file
|
|
95
|
+
decoder = (
|
|
96
|
+
codecs.getincrementaldecoder(encoding)(errors="replace") if is_text else None
|
|
97
|
+
)
|
|
98
|
+
try:
|
|
99
|
+
async for chunk in chunk_iter:
|
|
100
|
+
if decompressor:
|
|
101
|
+
chunk = decompressor.decompress(chunk)
|
|
102
|
+
if decoder:
|
|
103
|
+
text = decoder.decode(chunk)
|
|
104
|
+
if text:
|
|
105
|
+
target.write(text)
|
|
106
|
+
else:
|
|
107
|
+
target.write(chunk)
|
|
108
|
+
if decompressor:
|
|
109
|
+
remainder = decompressor.flush()
|
|
110
|
+
if remainder:
|
|
111
|
+
if decoder:
|
|
112
|
+
text = decoder.decode(remainder)
|
|
113
|
+
if text:
|
|
114
|
+
target.write(text)
|
|
115
|
+
else:
|
|
116
|
+
target.write(remainder)
|
|
117
|
+
if decoder:
|
|
118
|
+
tail = decoder.decode(b"", final=True)
|
|
119
|
+
if tail:
|
|
120
|
+
target.write(tail)
|
|
121
|
+
finally:
|
|
122
|
+
if close_after and should_close:
|
|
123
|
+
target.close()
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _iter_response_bytes_sync(response):
|
|
127
|
+
if hasattr(response, "iter_content"):
|
|
128
|
+
return response.iter_content(chunk_size=8192)
|
|
129
|
+
if hasattr(response, "iter_bytes"):
|
|
130
|
+
return response.iter_bytes()
|
|
131
|
+
return response.iter_content(chunk_size=8192)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def stream_to_file_sync(response, file, encoding, compression_algorithm):
|
|
135
|
+
target = _open_stream_target(file, encoding)
|
|
136
|
+
_stream_bytes_to_target_sync(
|
|
137
|
+
_iter_response_bytes_sync(response),
|
|
138
|
+
target,
|
|
139
|
+
encoding,
|
|
140
|
+
compression_algorithm,
|
|
141
|
+
True,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
async def stream_to_file_async(response, file, encoding, compression_algorithm):
|
|
146
|
+
target = _open_stream_target(file, encoding)
|
|
147
|
+
|
|
148
|
+
await _stream_bytes_to_target_async(
|
|
149
|
+
response.aiter_bytes(),
|
|
150
|
+
target,
|
|
151
|
+
encoding,
|
|
152
|
+
compression_algorithm,
|
|
153
|
+
True,
|
|
154
|
+
)
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
python_amazon_sp_api-1.9.18.data/scripts/make_endpoint,sha256=MqbRD0V9rsbkEEKsPOZbSinYVTArtDAMCIqPJIYL4gI,8551
|
|
2
|
-
sp_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
sp_api/__version__.py,sha256=Rq5dJlUx_Hv7jlc1f_8ldqp8tQ9WUh5TOKT7pxkGqNE,23
|
|
4
|
-
sp_api/api/__init__.py,sha256=WxpMNNNiQl97dz7TEz-9-qTGZraqlqYUBCaM1JbfLk0,4269
|
|
5
|
-
sp_api/api/amazon_warehousing_and_distribu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py,sha256=bMBIxIj0eu6Gi6WY3XLdHHYDzNCwz0-9X59Jo9DoqfE,5863
|
|
7
|
-
sp_api/api/aplus_content/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
sp_api/api/aplus_content/aplus_content.py,sha256=ugQd0ZbzK28JL7qCliufqqrnStqRlsR417vhO7eaTjs,18532
|
|
9
|
-
sp_api/api/application_management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
sp_api/api/application_management/application_management.py,sha256=xMCT3BvKSH1pjkHdU8CvbohNC2C9OR_-V_jNDVK9k00,1791
|
|
11
|
-
sp_api/api/authorization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
sp_api/api/authorization/authorization.py,sha256=G4bHrtfaCmkIkVONK5dfiXzTnTeLacxImQOitOK3Iu0,2798
|
|
13
|
-
sp_api/api/catalog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
sp_api/api/catalog/catalog.py,sha256=sDykeEaSmZZHwQ-6aYJvc9xDZqBGs9FlnUvKveE5ZCY,3956
|
|
15
|
-
sp_api/api/catalog_items/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
sp_api/api/catalog_items/catalog_items.py,sha256=TtPMh-75lL6HIPwxesEP1i8RGjmCuAPWdUptKdth_sU,4817
|
|
17
|
-
sp_api/api/data_kiosk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
sp_api/api/data_kiosk/data_kiosk.py,sha256=OyLyXtpAmPhfeDUqU2O7ovZ5e7K_ZAEcfyv3INNecyc,12175
|
|
19
|
-
sp_api/api/fba_inbound_eligibility/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py,sha256=rwzr7OF69b9OuNiq8wd2yL62_aGKgP8dAhkibUSjFcA,4425
|
|
21
|
-
sp_api/api/fba_small_and_light/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
sp_api/api/fba_small_and_light/fba_small_and_light.py,sha256=L959fSutNR5fNE6CGG7Fi44FLPgMixOM4u_vSfrh0b4,8416
|
|
23
|
-
sp_api/api/feeds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
sp_api/api/feeds/feeds.py,sha256=OddV53D7jxcsxYV7r_345qYrcXxRIlKpGfvh18AlKFo,10141
|
|
25
|
-
sp_api/api/finances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
-
sp_api/api/finances/finances.py,sha256=dW1s32LHZV1xGdznGbMaYuIzUgdlghgz5eyLWVflKQE,1912
|
|
27
|
-
sp_api/api/fulfillment_inbound/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
-
sp_api/api/fulfillment_inbound/fulfillment_inbound.py,sha256=IqZst1uTO1EJkN6IFk5KfyBBcQSFc5Qdt6O32laDTPc,84842
|
|
29
|
-
sp_api/api/fulfillment_outbound/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
-
sp_api/api/fulfillment_outbound/fulfillment_outbound.py,sha256=2XW8ZSJPzWTi3Pn6ewV6L_e_mi8UtJq0xiUIZXeUeQw,28789
|
|
31
|
-
sp_api/api/inventories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
|
-
sp_api/api/inventories/inventories.py,sha256=g5MRzjC9oAerND_b8NsWP7wBN0-R1G4qeVRtRT9jSEw,4217
|
|
33
|
-
sp_api/api/listings_items/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
sp_api/api/listings_items/listings_items.py,sha256=-6wsb0FTKq0PfVN0lUlS2OIu-YZq4sXzzixiugdPyH0,11749
|
|
35
|
-
sp_api/api/listings_restrictions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
-
sp_api/api/listings_restrictions/listings_restrictions.py,sha256=6ByAcUJuGfsr3Ww71DtraNUxejMFChjYcnBL9Hg7BwM,1710
|
|
37
|
-
sp_api/api/merchant_fulfillment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
|
-
sp_api/api/merchant_fulfillment/merchant_fulfillment.py,sha256=AXAhRBhOlcNtdgZk8butZvaSXD4OJ37RsX94EtIDYB8,15363
|
|
39
|
-
sp_api/api/messaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
sp_api/api/messaging/messaging.py,sha256=6bJWq0xtJiuCIHDKwFlLgNR_ieARcf3HLFm6mKI8EjU,17383
|
|
41
|
-
sp_api/api/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
|
-
sp_api/api/notifications/notifications.py,sha256=VbMQcRHlrLuZqx252kDR9n0zX2FVcEUOO0rW-1QJ3Oc,10937
|
|
43
|
-
sp_api/api/orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
-
sp_api/api/orders/orders.py,sha256=KgFslDL5lK6LyuhaBufkekNlrz8fR9O11apfPpnLVL8,12908
|
|
45
|
-
sp_api/api/product_fees/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
|
-
sp_api/api/product_fees/product_fees.py,sha256=M40hXGYUG1gs8FxH_EZUQPaihva-p7hyyzRCROqVghw,7784
|
|
47
|
-
sp_api/api/product_type_definitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
sp_api/api/product_type_definitions/product_type_definitions.py,sha256=sbQ4IurgxcXSJUTooX4KA8yu9e3EC0qq7Ax15T8lxcM,4472
|
|
49
|
-
sp_api/api/products/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
-
sp_api/api/products/products.py,sha256=5CnBlw8l5EQRAkxU46GyJCmKuxSa1bk_1fuJyk9lU74,12828
|
|
51
|
-
sp_api/api/products/products_definitions.py,sha256=CBOS_npegEw0kBUc2DfD67LOXrs-ox9ke3l98STGXMM,2337
|
|
52
|
-
sp_api/api/replenishment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
-
sp_api/api/replenishment/replenishment.py,sha256=ehaeQSClepIk3jp7vaHwgVrWljryk-C0WIFKcweeb_8,7506
|
|
54
|
-
sp_api/api/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
-
sp_api/api/reports/reports.py,sha256=ngNSRIN14PuR3uurAMlKeJLp3GaeWK4sYOoXzBNLRkE,19550
|
|
56
|
-
sp_api/api/sales/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
|
-
sp_api/api/sales/sales.py,sha256=tqV7FzvEU5QSz6OVc2wXog4Y2WPJaRoIDwca8aYmhh8,5763
|
|
58
|
-
sp_api/api/sellers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
|
-
sp_api/api/sellers/sellers.py,sha256=_tKEkBxZfeUxAAsHJIztq0PVADXg0s6Av3eatnsxtLQ,2275
|
|
60
|
-
sp_api/api/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
|
-
sp_api/api/services/services.py,sha256=09cJucV0zQsC8lRuQ5kJyG51t9ZkJ3HSYweKc1PoiG0,9242
|
|
62
|
-
sp_api/api/shipping/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
|
-
sp_api/api/shipping/shipping.py,sha256=xIjmu9LqGvnsSD7dGuFH7KY0VykHV3vfyvvX27aoLew,14531
|
|
64
|
-
sp_api/api/shipping/shippingV2.py,sha256=EMxAo0R1WqlyPBUzdc4fZpn4Oy2X4YJlwbkKdI7vmj0,25015
|
|
65
|
-
sp_api/api/solicitations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
66
|
-
sp_api/api/solicitations/solicitations.py,sha256=gTPST51WtEhcSIUF-DTsFy2Ag8DBglwWI1Q2GFP9BIU,3934
|
|
67
|
-
sp_api/api/supply_sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
|
-
sp_api/api/supply_sources/supply_sources.py,sha256=UpWpuyZac5of-hZ0WKjn9V4kIrFcNM-3MGmXjqjRj60,4544
|
|
69
|
-
sp_api/api/tokens/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
70
|
-
sp_api/api/tokens/tokens.py,sha256=UMuK3yBpXX0u5wUIEYJuOD7aH410gXy8pmFvBUMiK6M,3368
|
|
71
|
-
sp_api/api/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
|
-
sp_api/api/upload/upload.py,sha256=fp-so8uvqMs1cKuR6C54dDijfCjPr0ozMa9hrUBmDkc,652
|
|
73
|
-
sp_api/api/vendor_direct_fulfillment_inventory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
-
sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py,sha256=jVWIVsFhF4_h08kdZGObb011gKJSJSB4m1qcymrr0DY,2359
|
|
75
|
-
sp_api/api/vendor_direct_fulfillment_orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
|
-
sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py,sha256=Z28k0zBEbHA-NhzKkx7W_4NRy1IgJWb0C2ngUCGevpU,9454
|
|
77
|
-
sp_api/api/vendor_direct_fulfillment_payments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
78
|
-
sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py,sha256=OOMl4ddojBdyWVSPlQ4fmo0wH4cQ5_uJ_XkPD6_5WF4,10134
|
|
79
|
-
sp_api/api/vendor_direct_fulfillment_shipping/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
80
|
-
sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py,sha256=PmmhA9QDd5r_QXkbH3POTGR7MDckgGqY2F26lpgxWpI,28808
|
|
81
|
-
sp_api/api/vendor_direct_fulfillment_transactions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
82
|
-
sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py,sha256=hxpiZfJYslQhZF8ak-zKxH2_91Dwef6l3APYNa1T1oQ,1726
|
|
83
|
-
sp_api/api/vendor_invoices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
84
|
-
sp_api/api/vendor_invoices/vendor_invoices.py,sha256=wFT5rwXVTxx9rZg1tQJALn6HKEyY34easU25KWq4Ois,11261
|
|
85
|
-
sp_api/api/vendor_orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
86
|
-
sp_api/api/vendor_orders/vendor_orders.py,sha256=cA9QQjiwdlNEL0z8syuDovpahb2AAs6H9EGT2fyhbGw,13364
|
|
87
|
-
sp_api/api/vendor_shipments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
|
-
sp_api/api/vendor_shipments/vendor_shipments.py,sha256=EFzVetejcR3RLzH9iOMN_JFFXaIhPXi3cJ_4rNQf1JM,8678
|
|
89
|
-
sp_api/api/vendor_transaction_status/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
90
|
-
sp_api/api/vendor_transaction_status/vendor_transaction_status.py,sha256=hHDA4NSaLxuNUBWNpV5_MfPgRSEm3t0A7Yl9MY6pULc,1690
|
|
91
|
-
sp_api/auth/__init__.py,sha256=gb6opFLhOc3wL3lt7iS879P_ljflMepaFYEkqdlD_GQ,229
|
|
92
|
-
sp_api/auth/access_token_client.py,sha256=Unr10MMgItw78d6IAnMbn85JRl_sWElOHz7FinTk6m4,4678
|
|
93
|
-
sp_api/auth/access_token_response.py,sha256=_0UUopFHGNWHFwyeerCYWEDI61FRysDfSRb5JefCEuw,275
|
|
94
|
-
sp_api/auth/credentials.py,sha256=OndGKpAOupU6F6CmvOYNlK7uqgXia4DdHhW-u3IRKCk,262
|
|
95
|
-
sp_api/auth/exceptions.py,sha256=JCY74CZbxqSQ09huA1r_Z5kuD1k0O_sjD7sHhJI0aIk,424
|
|
96
|
-
sp_api/base/ApiResponse.py,sha256=2GDuOuOwpvYvhapBcAIn0Dd2DdMiGHdZ-L9B3qBGMWI,2216
|
|
97
|
-
sp_api/base/InventoryEnums.py,sha256=IQJ9AhcKpXadO4qP5i76kzHfP2EWQ-KTaZdR6MoOFjI,95
|
|
98
|
-
sp_api/base/__init__.py,sha256=IaBNIYLWsgvCKAfbMXLVPZdo2Wkw5ZdUhH8vxFfj0wc,2617
|
|
99
|
-
sp_api/base/base_client.py,sha256=uQEIgDexDlUPCTFuZucEsIxktBlZDmsSw4LUvNrVPxo,223
|
|
100
|
-
sp_api/base/client.py,sha256=7C_0_TXGt8Ml91FAawxrCIRqH7F3VGw7NVvBesLpe-M,7601
|
|
101
|
-
sp_api/base/credential_provider.py,sha256=PbhHsVXGw0abdmHNSk5UiEy3cn5cf7AQttnelSYOofY,5972
|
|
102
|
-
sp_api/base/exceptions.py,sha256=gniV45duxHdD_TWsN9023SObVpPLwMtBzkXlKQrWvYo,4001
|
|
103
|
-
sp_api/base/feedTypes.py,sha256=9iI64uXULqUbVLVANftzltFmpFRgtgSDsARTMQ28jvo,2479
|
|
104
|
-
sp_api/base/fulfillment_channel.py,sha256=x-0DnVC1U_6GdeYViGQxM7Ree48HKBSXR2x8y33MuO4,93
|
|
105
|
-
sp_api/base/helpers.py,sha256=bm3Kc0_lpq9yQOlAGyR5iF99NfggwdrVautR2kDmaE4,2497
|
|
106
|
-
sp_api/base/identifiersType.py,sha256=3jBIeSlXDaV7Ikc8k9p67m4T7rJYfkevdGW3ZOdAScQ,562
|
|
107
|
-
sp_api/base/included_data.py,sha256=WccyLjgeiUTApIu6UFOsn0-o_SjfnBF1r-3zj7EQ7Ag,2977
|
|
108
|
-
sp_api/base/inegibility_reasons.py,sha256=vyQ8buMNwXUeV2cp7kZxtzbBkflqaMxuND_LlUtY2hA,9349
|
|
109
|
-
sp_api/base/marketplaces.py,sha256=H96HaIrnpAVcFCJF9LYEA_U0nuSHhVw1v-exzVbmxnQ,4258
|
|
110
|
-
sp_api/base/notifications.py,sha256=yAajFMCPAYzuuc1VaVNp1Jt71M_KR1PiSoq92TvHwxE,5448
|
|
111
|
-
sp_api/base/processing_status.py,sha256=V6YVoAE1pO3vrusDz0Sahc-DqgJqeNDuIaJIduXuDb4,183
|
|
112
|
-
sp_api/base/reportTypes.py,sha256=tS1U813oUWBCpRdX6gx8OYx9gk7eLLQsVgElM3AaI7w,10323
|
|
113
|
-
sp_api/base/report_status.py,sha256=mHPPFvK2xpfucCl6Vk87BHFJO8FB1x0Ej-h3fQFOetE,179
|
|
114
|
-
sp_api/base/sales_enum.py,sha256=O08knipDvuPEBYPM3kYEofl7t6uGZ-nJrn0L9q3CX9w,395
|
|
115
|
-
sp_api/base/schedules.py,sha256=WX0tYSAK4kI-ceBqeE_cY2_MaKC2usEgV2FDqujioqI,433
|
|
116
|
-
sp_api/util/__init__.py,sha256=sqI3L1gYCvC-BwpVEBXEWHHWzijoJabEsN4UTCGswm8,298
|
|
117
|
-
sp_api/util/key_maker.py,sha256=T4I2rdBZzvWtX32qgrv9DA5EzVK3LEAWtbRffup-_kE,2172
|
|
118
|
-
sp_api/util/load_all_pages.py,sha256=6ogkJKyhKAqNAq54gyN6YEYxxIYC8QQaW_I23S7krDo,1839
|
|
119
|
-
sp_api/util/load_date_bound.py,sha256=j9gu9WucENqU9xaQ-xG7c4yK4RB-FXK39_r1mLT76z0,1726
|
|
120
|
-
sp_api/util/retry.py,sha256=V8SeSeX3Brdou138hNA5HeQkKlHppZcqbZobIDjmBYw,2407
|
|
121
|
-
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
122
|
-
tests/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
123
|
-
tests/api/finances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
124
|
-
tests/api/finances/test_finances.py,sha256=pbbQKZzFWPrylw_JbCekCwingPBvMJ5ON8cp_X7iUyg,584
|
|
125
|
-
tests/api/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
126
|
-
tests/api/notifications/test_notifications.py,sha256=ln4sM3Rfspax_QCARkmrqOKBWfYx_a-4KNje5YJ9Io8,1293
|
|
127
|
-
tests/api/orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
|
-
tests/api/orders/test_orders.py,sha256=j568TSG55x8afPhlFmwTyjVBmMdo6pcAr1esGH3RlUo,3717
|
|
129
|
-
tests/api/product_fees/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
130
|
-
tests/api/product_fees/product_fees.py,sha256=3d4alLRlAQzfbmxWu2LWGVg4jsozc6A5BvmkJLtt9cM,2542
|
|
131
|
-
tests/api/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
132
|
-
tests/api/reports/test_reports.py,sha256=Ni0QpflVEJlZYk696cKTe5BasoeSWAyXxpxSJnFcGHI,3974
|
|
133
|
-
tests/api/sellers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
134
|
-
tests/api/sellers/test_sellers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
135
|
-
tests/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
136
|
-
tests/client/test_auth.py,sha256=fI4Lo5Z6O0GfqIldPlCe1OAoZRfAvMRjomo-mGfQxfs,1993
|
|
137
|
-
tests/client/test_base.py,sha256=SaXsycFpNYWy8zEYGVzb0aYUZuhJ4qz1_8oAvy6XAvg,4905
|
|
138
|
-
tests/client/test_credential_provider.py,sha256=qSBVgDEaR7_C2CmJOY7KAmxNMOfVeE4qG0hfXH3Gk2o,1476
|
|
139
|
-
tests/client/test_helpers.py,sha256=RzpnytJGSEIFDRqcMm2QpdIqZubDfNNQRNVgvZPX3K0,3731
|
|
140
|
-
python_amazon_sp_api-1.9.18.dist-info/LICENSE,sha256=nbzomPIVo1PVl5bpGAntofsYAF7ZQ2UhzOtKgf7IiNw,1071
|
|
141
|
-
python_amazon_sp_api-1.9.18.dist-info/METADATA,sha256=BANQlzIxFR9jS9uUbjDiGNz6SX3DrF8e4-PlkCvFaYQ,6379
|
|
142
|
-
python_amazon_sp_api-1.9.18.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
143
|
-
python_amazon_sp_api-1.9.18.dist-info/top_level.txt,sha256=oZPLMXOmLpAhwQ2La20WfRtlOYlnjub0v419-qPfwkw,13
|
|
144
|
-
python_amazon_sp_api-1.9.18.dist-info/RECORD,,
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from datetime import datetime, timedelta
|
|
3
|
-
|
|
4
|
-
from sp_api.api import Finances
|
|
5
|
-
from sp_api.base import SellingApiBadRequestException
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def test_for_order():
|
|
9
|
-
res = Finances().get_financial_events_for_order('485-734-5434857', MaxResultsPerPage=10)
|
|
10
|
-
assert res.payload.get('NextToken') == 'Next token value'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def test_for_order_expect_400():
|
|
14
|
-
try:
|
|
15
|
-
Finances().get_financial_events_for_order('BAD-ORDER', MaxResultsPerPage=10)
|
|
16
|
-
except SellingApiBadRequestException as br:
|
|
17
|
-
assert br.code == 400
|
|
18
|
-
assert type(br) == SellingApiBadRequestException
|
|
19
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
from sp_api.api import Notifications, Reports, Finances
|
|
2
|
-
from sp_api.base import SellingApiException, NotificationType, ReportType, Marketplaces
|
|
3
|
-
from sp_api.util import throttle_retry, load_all_pages
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def test_create_destination():
|
|
7
|
-
res = Notifications().create_destination(name='test', arn='arn:aws:sqs:us-east-2:444455556666:queue1')
|
|
8
|
-
assert res.payload.get("destinationId") == "TEST_CASE_200_DESTINATION_ID"
|
|
9
|
-
assert res.payload.get("resource").get('sqs').get('arn') == "arn:aws:sqs:us-east-2:444455556666:queue1"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def test_create_subscription():
|
|
13
|
-
res = Notifications().create_subscription(NotificationType.MFN_ORDER_STATUS_CHANGE, destination_id='dest_id')
|
|
14
|
-
assert res.payload.get('destinationId') == 'TEST_CASE_200_DESTINATION_ID'
|
|
15
|
-
assert res.payload.get('subscriptionId') == 'TEST_CASE_200_SUBSCRIPTION_ID'
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def test_delete_subscription():
|
|
19
|
-
res = Notifications().delete_notification_subscription(NotificationType.MFN_ORDER_STATUS_CHANGE, 'subscription_id')
|
|
20
|
-
assert res.errors is None
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def test_get_subscriptions():
|
|
24
|
-
res = Notifications().get_subscription(NotificationType.REPORT_PROCESSING_FINISHED)
|
|
25
|
-
assert res.payload.get('destinationId') == 'TEST_CASE_200_DESTINATION_ID'
|
|
26
|
-
assert res.payload.get('subscriptionId') == 'TEST_CASE_200_SUBSCRIPTION_ID'
|
tests/api/orders/test_orders.py
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
from sp_api.api import Orders
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_get_orders():
|
|
5
|
-
res = Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
|
|
6
|
-
assert res.errors is None
|
|
7
|
-
assert res.payload.get('Orders') is not None
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def test_get_order_items():
|
|
11
|
-
res = Orders().get_order_items('TEST_CASE_200')
|
|
12
|
-
assert res.errors is None
|
|
13
|
-
assert res.payload.get('AmazonOrderId') is not None
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def test_get_order_address():
|
|
17
|
-
res = Orders().get_order_address('TEST_CASE_200')
|
|
18
|
-
assert res.errors is None
|
|
19
|
-
assert res.payload.get('AmazonOrderId') is not None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def test_get_order_buyer_info():
|
|
23
|
-
res = Orders().get_order_buyer_info('TEST_CASE_200')
|
|
24
|
-
assert res.errors is None
|
|
25
|
-
assert res.payload.get('AmazonOrderId') is not None
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_get_order():
|
|
29
|
-
res = Orders().get_order('TEST_CASE_200')
|
|
30
|
-
assert res.errors is None
|
|
31
|
-
assert res.payload.get('AmazonOrderId') is not None
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def test_get_order_items_buyer_info():
|
|
35
|
-
res = Orders().get_order_items_buyer_info('TEST_CASE_200')
|
|
36
|
-
assert res.errors is None
|
|
37
|
-
assert res.payload.get('AmazonOrderId') is not None
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def test_get_orders_400_error():
|
|
41
|
-
from sp_api.base import SellingApiBadRequestException
|
|
42
|
-
try:
|
|
43
|
-
Orders().get_orders(CreatedAfter='TEST_CASE_400')
|
|
44
|
-
except SellingApiBadRequestException as sep:
|
|
45
|
-
assert sep.code == 400
|
|
46
|
-
assert sep.amzn_code == 'InvalidInput'
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def test_get_order_api_response_call():
|
|
50
|
-
res = Orders().get_order('TEST_CASE_200')
|
|
51
|
-
print(res('DefaultShipFromLocationAddress'))
|
|
52
|
-
assert res('DefaultShipFromLocationAddress') is not None
|
|
53
|
-
assert res.errors is None
|
|
54
|
-
assert res.payload.get('AmazonOrderId') is not None
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def test_get_orders_attr():
|
|
58
|
-
res = Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
|
|
59
|
-
assert res.Orders is not None
|
|
60
|
-
assert res.errors is None
|
|
61
|
-
assert res.payload.get('Orders') is not None
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def test_get_order_api_response_call2():
|
|
65
|
-
res = Orders().get_order('TEST_CASE_200')
|
|
66
|
-
assert res() is not None
|
|
67
|
-
assert isinstance(res(), dict)
|
|
68
|
-
assert res.errors is None
|
|
69
|
-
assert res.payload.get('AmazonOrderId') is not None
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def test_update_shipment_status():
|
|
73
|
-
res = Orders().update_shipment_status(
|
|
74
|
-
order_id='123-1234567-1234567',
|
|
75
|
-
marketplaceId='ATVPDKIKX0DER',
|
|
76
|
-
shipmentStatus='ReadyForPickup'
|
|
77
|
-
)
|
|
78
|
-
assert res() is not None
|
|
79
|
-
assert isinstance(res(), dict)
|
|
80
|
-
assert res.errors is None
|
|
81
|
-
assert res.payload.get("status_code") == 204
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def test_confirm_shipment():
|
|
85
|
-
res = Orders().confirm_shipment(
|
|
86
|
-
order_id='123-1234567-1234567',
|
|
87
|
-
marketplaceId='ATVPDKIKX0DER',
|
|
88
|
-
packageDetail={
|
|
89
|
-
'packageReferenceId': '0001',
|
|
90
|
-
'carrierCode': 'DHL',
|
|
91
|
-
"shippingMethod": 'Paket',
|
|
92
|
-
'trackingNumber': '1234567890',
|
|
93
|
-
'shipDate': '2023-03-19T12:00:00Z',
|
|
94
|
-
'orderItems': [
|
|
95
|
-
{
|
|
96
|
-
'orderItemId': '123456789',
|
|
97
|
-
'quantity': 1
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
'orderItemId': '2345678901',
|
|
101
|
-
'quantity': 2
|
|
102
|
-
},
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
assert res() is not None
|
|
107
|
-
assert isinstance(res(), dict)
|
|
108
|
-
assert res.errors is None
|
|
109
|
-
assert res.payload.get("status_code") is None
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
def test_update_shipment_status_400_error():
|
|
113
|
-
from sp_api.base import SellingApiBadRequestException
|
|
114
|
-
try:
|
|
115
|
-
Orders().update_shipment_status(
|
|
116
|
-
order_id='123-1234567-1234567',
|
|
117
|
-
marketplaceId='1',
|
|
118
|
-
shipmentStatus='ReadyForPickup'
|
|
119
|
-
)
|
|
120
|
-
except SellingApiBadRequestException as sep:
|
|
121
|
-
assert sep.code == 400
|
|
122
|
-
assert sep.amzn_code == 'InvalidInput'
|