Skip to content

Commit

Permalink
added listings_restrictions endpoint and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
red committed Dec 10, 2021
1 parent 56c4372 commit 713f01c
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/endpoints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ Endpoints
endpoints/listings_items
endpoints/product_type_definitions
endpoints/catalog_items
endpoints/listings_items
endpoints/product_type_definitions
endpoints/catalog_items
endpoints/listings_restrictions
5 changes: 5 additions & 0 deletions docs/endpoints/listings_restrictions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ListingsRestrictions
====================


.. autoclass:: sp_api.api.ListingsRestrictions
4 changes: 1 addition & 3 deletions make_endpoint/make_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import re

dirs = [
'listings_items',
'product_type_definitions',
'catalog_items'
'listings_restrictions'
]


Expand Down
3 changes: 2 additions & 1 deletion make_endpoint/make_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def get_endpoint_from_url(url):
# 'https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/catalog-items-api-model/catalogItems_2020-12-01.json'
# 'https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/messaging-api-model/messaging.json'
# 'https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/reports-api-model/reports_2021-06-30.json'
'https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/feeds-api-model/feeds_2021-06-30.json'
# 'https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/feeds-api-model/feeds_2021-06-30.json'
# 'https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/listings-restrictions-api-model/listingsRestrictions_2021-08-01.json'
]:
try:
create_endpoint_file(model_json_url)
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
'sp_api.base',
'sp_api.util',
##### DO NOT DELETE ########## INSERT PACKAGE HERE #######
'sp_api.api.listings_restrictions',


'sp_api.api.catalog_items',
'sp_api.api.product_type_definitions',
Expand Down
4 changes: 4 additions & 0 deletions sp_api/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from .merchant_fulfillment.merchant_fulfillment import MerchantFulfillment

##### DO NOT DELETE ########## INSERT IMPORT HERE #######
from .listings_restrictions.listings_restrictions import ListingsRestrictions



from .messaging.messaging import Messaging
Expand Down Expand Up @@ -84,6 +86,8 @@
"FulfillmentInbound",
"MerchantFulfillment",
##### DO NOT DELETE ########## INSERT TITLE HERE #######
"ListingsRestrictions",

"Feeds",

"ReportsV2",
Expand Down
Empty file.
50 changes: 50 additions & 0 deletions sp_api/api/listings_restrictions/listings_restrictions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import urllib.parse

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


class ListingsRestrictions(Client):
"""
ListingsRestrictions SP-API Client
:link:
The Selling Partner API for Listings Restrictions provides programmatic access to restrictions on Amazon catalog listings.
For more information, see the [Listings Restrictions API Use Case Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/listings-restrictions-api-use-case-guide/listings-restrictions-api-use-case-guide_2021-08-01.md).
"""


@sp_endpoint('/listings/2021-08-01/restrictions', method='GET')
def get_listings_restrictions(self, **kwargs) -> ApiResponse:
"""
get_listings_restrictions(self, **kwargs) -> ApiResponse
Returns listing restrictions for an item in the Amazon Catalog.
**Usage Plan:**
| Rate (requests per second) | Burst |
| ---- | ---- |
| 5 | 10 |
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 then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/usage-plans-rate-limits/Usage-Plans-and-Rate-Limits.md).
Args:
key asin:string | * REQUIRED The Amazon Standard Identification Number (ASIN) of the item.
key conditionType:string | The condition used to filter restrictions.
key sellerId:string | * REQUIRED A selling partner identifier, such as a merchant account.
key marketplaceIds:array | * REQUIRED A comma-delimited list of Amazon marketplace identifiers for the request.
key reasonLocale:string | A locale for reason text localization. When not provided, the default language code of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US" when a localization is not available in the specified locale.
Returns:
ApiResponse:
"""

return self._request(kwargs.pop('path'), params=kwargs)

0 comments on commit 713f01c

Please sign in to comment.