Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion make_endpoint/template.py.jinja2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import urllib.parse
import six.moves.urllib as urllib

from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse

Expand Down
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pytest
requests~=2.28.1
six>=1.15,<2
boto3~=1.24.21
cachetools~=5.2.0
setuptools~=62.6.0
pytz~=2022.1
confuse~=1.7.0
requests==2.25.1
six==1.16.0
boto3==1.16.63
cachetools==3.1.1
setuptools==44.0.0
pytz==2020.5
confuse==2.0.0
jinja2

enum34==1.1.10
15 changes: 9 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
name='python-amazon-sp-api',
version=__version__,
install_requires=[
"requests",
"six>=1.15,<2",
"boto3>=1.16.39,<2",
"cachetools>=4.2,<5.3",
"pytz",
"confuse>=1.4,<1.8"
"requests==2.25.1",
"six==1.16.0",
"boto3==1.16.63",
"cachetools==3.1.1",
"setuptools==44.0.0",
"pytz==2020.5",
"confuse==2.0.0",
"enum34==1.1.10",
"future-fstrings==1.2.0"
],
packages=['tests', 'tests.api', 'tests.api.orders', 'tests.api.sellers', 'tests.api.finances',
'tests.api.product_fees', 'tests.api.notifications', 'tests.api.reports', 'tests.client',
Expand Down
43 changes: 22 additions & 21 deletions sp_api/api/aplus_content/aplus_content.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib.parse
import six.moves.urllib as urllib

from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse


Expand All @@ -12,9 +13,9 @@ class AplusContent(Client):


@sp_endpoint('/aplus/2020-11-01/contentDocuments', method='GET')
def search_content_documents(self, **kwargs) -> ApiResponse:
def search_content_documents(self, **kwargs):
"""
search_content_documents(self, **kwargs) -> ApiResponse
search_content_documents(self, **kwargs)

Returns a list of all A+ Content documents assigned to a selling partner. This operation returns only the metadata of the A+ Content documents. Call the getContentDocument operation to get the actual contents of the A+ Content documents.

Expand All @@ -41,9 +42,9 @@ def search_content_documents(self, **kwargs) -> ApiResponse:


@sp_endpoint('/aplus/2020-11-01/contentDocuments', method='POST')
def create_content_document(self, **kwargs) -> ApiResponse:
def create_content_document(self, **kwargs):
"""
create_content_document(self, **kwargs) -> ApiResponse
create_content_document(self, **kwargs)

Creates a new A+ Content document.

Expand Down Expand Up @@ -71,9 +72,9 @@ def create_content_document(self, **kwargs) -> ApiResponse:


@sp_endpoint('/aplus/2020-11-01/contentDocuments/{}', method='GET')
def get_content_document(self, contentReferenceKey, **kwargs) -> ApiResponse:
def get_content_document(self, contentReferenceKey, **kwargs):
"""
get_content_document(self, contentReferenceKey, **kwargs) -> ApiResponse
get_content_document(self, contentReferenceKey, **kwargs)

Returns an A+ Content document, if available.

Expand Down Expand Up @@ -101,9 +102,9 @@ def get_content_document(self, contentReferenceKey, **kwargs) -> ApiResponse:
return self._request(fill_query_params(kwargs.pop('path'), contentReferenceKey), params=kwargs)

@sp_endpoint('/aplus/2020-11-01/contentDocuments/{}', method='POST')
def update_content_document(self, contentReferenceKey, **kwargs) -> ApiResponse:
def update_content_document(self, contentReferenceKey, **kwargs):
"""
update_content_document(self, contentReferenceKey, **kwargs) -> ApiResponse
update_content_document(self, contentReferenceKey, **kwargs)

Updates an existing A+ Content document.

Expand All @@ -129,9 +130,9 @@ def update_content_document(self, contentReferenceKey, **kwargs) -> ApiResponse:


@sp_endpoint('/aplus/2020-11-01/contentDocuments/{}/asins', method='GET')
def list_content_document_asin_relations(self, contentReferenceKey, **kwargs) -> ApiResponse:
def list_content_document_asin_relations(self, contentReferenceKey, **kwargs):
"""
list_content_document_asin_relations(self, contentReferenceKey, **kwargs) -> ApiResponse
list_content_document_asin_relations(self, contentReferenceKey, **kwargs)

Returns a list of ASINs related to the specified A+ Content document, if available. If you do not include the asinSet parameter, the operation returns all ASINs related to the content document.

Expand Down Expand Up @@ -159,9 +160,9 @@ def list_content_document_asin_relations(self, contentReferenceKey, **kwargs) ->


@sp_endpoint('/aplus/2020-11-01/contentDocuments/{}/asins', method='POST')
def post_content_document_asin_relations(self, contentReferenceKey, **kwargs) -> ApiResponse:
def post_content_document_asin_relations(self, contentReferenceKey, **kwargs):
"""
post_content_document_asin_relations(self, contentReferenceKey, **kwargs) -> ApiResponse
post_content_document_asin_relations(self, contentReferenceKey, **kwargs)

Replaces all ASINs related to the specified A+ Content document, if available. This may add or remove ASINs, depending on the current set of related ASINs. Removing an ASIN has the side effect of suspending the content document from that ASIN.

Expand All @@ -187,9 +188,9 @@ def post_content_document_asin_relations(self, contentReferenceKey, **kwargs) ->


@sp_endpoint('/aplus/2020-11-01/contentAsinValidations', method='POST')
def validate_content_document_asin_relations(self, **kwargs) -> ApiResponse:
def validate_content_document_asin_relations(self, **kwargs):
"""
validate_content_document_asin_relations(self, **kwargs) -> ApiResponse
validate_content_document_asin_relations(self, **kwargs)

Checks if the A+ Content document is valid for use on a set of ASINs.

Expand All @@ -216,9 +217,9 @@ def validate_content_document_asin_relations(self, **kwargs) -> ApiResponse:


@sp_endpoint('/aplus/2020-11-01/contentPublishRecords', method='GET')
def search_content_publish_records(self, **kwargs) -> ApiResponse:
def search_content_publish_records(self, **kwargs):
"""
search_content_publish_records(self, **kwargs) -> ApiResponse
search_content_publish_records(self, **kwargs)

Searches for A+ Content publishing records, if available.

Expand All @@ -244,9 +245,9 @@ def search_content_publish_records(self, **kwargs) -> ApiResponse:


@sp_endpoint('/aplus/2020-11-01/contentDocuments/{}/approvalSubmissions', method='POST')
def post_content_document_approval_submission(self, contentReferenceKey, **kwargs) -> ApiResponse:
def post_content_document_approval_submission(self, contentReferenceKey, **kwargs):
"""
post_content_document_approval_submission(self, contentReferenceKey, **kwargs) -> ApiResponse
post_content_document_approval_submission(self, contentReferenceKey, **kwargs)

Submits an A+ Content document for review, approval, and publishing.

Expand All @@ -271,9 +272,9 @@ def post_content_document_approval_submission(self, contentReferenceKey, **kwarg


@sp_endpoint('/aplus/2020-11-01/contentDocuments/{}/suspendSubmissions', method='POST')
def post_content_document_suspend_submission(self, contentReferenceKey, **kwargs) -> ApiResponse:
def post_content_document_suspend_submission(self, contentReferenceKey, **kwargs):
"""
post_content_document_suspend_submission(self, contentReferenceKey, **kwargs) -> ApiResponse
post_content_document_suspend_submission(self, contentReferenceKey, **kwargs)

Submits a request to suspend visible A+ Content. This neither deletes the content document nor the ASIN relations.

Expand Down
6 changes: 3 additions & 3 deletions sp_api/api/authorization/authorization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import urllib.parse
import six.moves.urllib as urllib

from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse

Expand All @@ -13,9 +13,9 @@ class Authorization(Client):
grantless_scope = 'sellingpartnerapi::migration'

@sp_endpoint('/authorization/v1/authorizationCode', method='GET')
def get_authorization_code(self, **kwargs) -> ApiResponse:
def get_authorization_code(self, **kwargs):
"""
get_authorization_code(self, **kwargs) -> ApiResponse
get_authorization_code(self, **kwargs)

With the getAuthorizationCode operation, you can request a Login With Amazon (LWA) authorization code that will allow you to call a Selling Partner API on behalf of a seller who has already authorized you to call Amazon Marketplace Web Service (Amazon MWS). You specify a developer ID, an MWS auth token, and a seller ID. Taken together, these represent the Amazon MWS authorization that the seller previously granted you. The operation returns an LWA authorization code that can be exchanged for a refresh token and access token representing authorization to call the Selling Partner API on the seller's behalf. By using this API, sellers who have already authorized you for Amazon MWS do not need to re-authorize you for the Selling Partner API.

Expand Down
14 changes: 7 additions & 7 deletions sp_api/api/catalog/catalog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import urllib.parse
import six.moves.urllib as urllib

from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse

Expand All @@ -10,9 +10,9 @@ class Catalog(Client):
"""

@sp_endpoint('/catalog/v0/items/{}')
def get_item(self, asin: str, **kwargs) -> ApiResponse:
def get_item(self, asin, **kwargs):
"""
get_item(self, asin: str, **kwargs) -> ApiResponse
get_item(self, asin: str, **kwargs)
Returns a specified item and its attributes.

**Usage Plan:**
Expand Down Expand Up @@ -41,9 +41,9 @@ def get_item(self, asin: str, **kwargs) -> ApiResponse:
return self._request(fill_query_params(kwargs.pop('path'), asin), params=kwargs)

@sp_endpoint('/catalog/v0/items')
def list_items(self, **kwargs) -> ApiResponse:
def list_items(self, **kwargs):
"""
list_items(self, **kwargs) -> ApiResponse
list_items(self, **kwargs)
Returns a list of items and their attributes, based on a search query or item identifiers that you specify. When based on a search query, provide the Query parameter and optionally, the QueryContextId parameter. When based on item identifiers, provide a single appropriate parameter based on the identifier type, and specify the associated item value. MarketplaceId is always required.

**Usage Plan:**
Expand Down Expand Up @@ -80,9 +80,9 @@ def list_items(self, **kwargs) -> ApiResponse:
return self._request(kwargs.pop('path'), params=kwargs)

@sp_endpoint('/catalog/v0/categories')
def list_categories(self, **kwargs) -> ApiResponse:
def list_categories(self, **kwargs):
"""
list_categories(self, **kwargs) -> ApiResponse
list_categories(self, **kwargs)
Returns the parent categories to which an item belongs, based on the specified ASIN or SellerSKU

**Usage Plan:**
Expand Down
14 changes: 7 additions & 7 deletions sp_api/api/catalog_items/catalog_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ class CatalogItemsVersion(str, enum.Enum):
LATEST = "2022-04-01"


class CatalogItems(Client):
class CatalogItems(Client, object):
"""
CatalogItems SP-API Client
:link:

The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog.
"""

version: CatalogItemsVersion = CatalogItemsVersion.V_2020_12_01
version = CatalogItemsVersion.V_2020_12_01

def __init__(self, *args, **kwargs):
if 'version' in kwargs:
self.version = kwargs.get('version', CatalogItemsVersion.V_2020_12_01)
super().__init__(*args, **{**kwargs, 'version': self.version})
super(CatalogItems, self).__init__(*args, **dict(kwargs, version = self.version))

@sp_endpoint('/catalog/<version>/items', method='GET')
def search_catalog_items(self, **kwargs) -> ApiResponse:
def search_catalog_items(self, **kwargs):
"""
search_catalog_items(self, **kwargs) -> ApiResponse
search_catalog_items(self, **kwargs)

Search for and return a list of Amazon catalog items and associated information.

Expand Down Expand Up @@ -59,9 +59,9 @@ def search_catalog_items(self, **kwargs) -> ApiResponse:
return self._request(kwargs.pop('path'), params=kwargs)

@sp_endpoint('/catalog/<version>/items/{}', method='GET')
def get_catalog_item(self, asin, **kwargs) -> ApiResponse:
def get_catalog_item(self, asin, **kwargs):
"""
get_catalog_item(self, asin, **kwargs) -> ApiResponse
get_catalog_item(self, asin, **kwargs)

Retrieves details for an item in the Amazon catalog.

Expand Down
8 changes: 4 additions & 4 deletions sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import urllib.parse
import six.moves.urllib as urllib

from sp_api.base import Client, sp_endpoint, fill_query_params, IneligibilityReasonList, ApiResponse

Expand All @@ -13,9 +13,9 @@ class FbaInboundEligibility(Client):


@sp_endpoint('/fba/inbound/v1/eligibility/itemPreview', method='GET')
def get_item_eligibility_preview(self, **kwargs) -> ApiResponse:
def get_item_eligibility_preview(self, **kwargs):
"""
get_item_eligibility_preview(self, **kwargs) -> ApiResponse
get_item_eligibility_preview(self, **kwargs)

This operation gets an eligibility preview for an item that you specify. You can specify the type of eligibility preview that you want (INBOUND or COMMINGLING). For INBOUND previews, you can specify the marketplace in which you want to determine the item's eligibility.

Expand All @@ -42,7 +42,7 @@ def get_item_eligibility_preview(self, **kwargs) -> ApiResponse:
return self._request(kwargs.pop('path'), params=kwargs)

@sp_endpoint('/fba/inbound/v1/eligibility/itemPreview', method='GET')
def get_item_eligibility_preview_extended(self, **kwargs) -> ApiResponse:
def get_item_eligibility_preview_extended(self, **kwargs):
"""
get_item_eligibility_preview_extended(self, **kwargs) -> ApiResponse

Expand Down
30 changes: 15 additions & 15 deletions sp_api/api/fba_small_and_light/fba_small_and_light.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import urllib.parse
import six.moves.urllib as urllib

from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, deprecated

Expand All @@ -12,13 +12,13 @@ class FbaSmallAndLight(Client):
"""

@deprecated
def get_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse:
def get_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs):
return self.get_small_and_light_enrollment_by_seller_sku(sellerSKU, **kwargs)

@sp_endpoint('/fba/smallAndLight/v1/enrollments/{}', method='GET')
def get_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs) -> ApiResponse:
def get_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs):
"""
get_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
get_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs)

Returns the Small and Light enrollment status for the item indicated by the specified seller SKU in the specified marketplace.

Expand All @@ -43,13 +43,13 @@ def get_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs) ->
return self._request(fill_query_params(kwargs.pop('path'), seller_sku), params=kwargs)

@deprecated
def put_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse:
def put_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs):
return self.put_small_and_light_enrollment_by_seller_sku(sellerSKU, **kwargs)

@sp_endpoint('/fba/smallAndLight/v1/enrollments/{}', method='PUT')
def put_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs) -> ApiResponse:
def put_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs):
"""
put_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
put_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs)

Enrolls the item indicated by the specified seller SKU in the Small and Light program in the specified marketplace. If the item is not eligible, the ineligibility reasons are returned.

Expand All @@ -76,13 +76,13 @@ def put_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs) ->
params={'marketplaceIds': kwargs.get('marketplaceIds', self.marketplace_id)})

@deprecated
def delete_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse:
def delete_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs):
return self.delete_small_and_light_enrollment_by_seller_sku(sellerSKU, **kwargs)

@sp_endpoint('/fba/smallAndLight/v1/enrollments/{}', method='DELETE')
def delete_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs) -> ApiResponse:
def delete_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs):
"""
delete_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
delete_small_and_light_enrollment_by_seller_s_k_u(self, sellerSKU, **kwargs)

Removes the item indicated by the specified seller SKU from the Small and Light program in the specified marketplace. If the item is not eligible for disenrollment, the ineligibility reasons are returned.

Expand All @@ -107,13 +107,13 @@ def delete_small_and_light_enrollment_by_seller_sku(self, seller_sku, **kwargs)
return self._request(fill_query_params(kwargs.pop('path'), seller_sku), data=kwargs)

@deprecated
def get_small_and_light_eligibility_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse:
def get_small_and_light_eligibility_by_seller_s_k_u(self, sellerSKU, **kwargs):
return self.get_small_and_light_eligibility_by_seller_sku(sellerSKU, **kwargs)

@sp_endpoint('/fba/smallAndLight/v1/eligibilities/{}', method='GET')
def get_small_and_light_eligibility_by_seller_sku(self, seller_sku, **kwargs) -> ApiResponse:
def get_small_and_light_eligibility_by_seller_sku(self, seller_sku, **kwargs):
"""
get_small_and_light_eligibility_by_seller_s_k_u(self, sellerSKU, **kwargs) -> ApiResponse
get_small_and_light_eligibility_by_seller_s_k_u(self, sellerSKU, **kwargs)

Returns the Small and Light program eligibility status of the item indicated by the specified seller SKU in the specified marketplace. If the item is not eligible, the ineligibility reasons are returned.

Expand All @@ -139,9 +139,9 @@ def get_small_and_light_eligibility_by_seller_sku(self, seller_sku, **kwargs) ->
return self._request(fill_query_params(kwargs.pop('path'), seller_sku), params=kwargs)

@sp_endpoint('/fba/smallAndLight/v1/feePreviews', method='POST')
def get_small_and_light_fee_preview(self, **kwargs) -> ApiResponse:
def get_small_and_light_fee_preview(self, **kwargs):
"""
get_small_and_light_fee_preview(self, **kwargs) -> ApiResponse
get_small_and_light_fee_preview(self, **kwargs)

Returns the Small and Light fee estimates for the specified items. You must include a marketplaceId parameter to retrieve the proper fee estimates for items to be sold in that marketplace. The ordering of items in the response will mirror the order of the items in the request. Duplicate ASIN/price combinations are removed.

Expand Down
Loading