Responses
All endpoints return sp_api.base.ApiResponse with the following signature. payload contains Amazon’s response.
response = Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
print(response.payload) # original response data
# Access one of `payload`s properties using `__getattr__`
print(response.Orders) # Array of orders
# Access one of `payload`s properties using `__call__`
print(response('Orders')) # Array of orders
# Shorthand for response.payload
print(response()) # original response data
- class sp_api.base.ApiResponse(payload=None, errors=None, pagination=None, headers=None, nextToken=None, **kwargs)
Api Response
Wrapper around all responses from the API.
Examples
literal blocks:
response = Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"]) print(response.payload) # original response data # Access one of `payload`s properties using `__getattr__` print(response.Orders) # Array of orders # Access one of `payload`s properties using `__call__` print(response('Orders')) # Array of orders # Shorthand for response.payload print(response()) # original response data
- Parameters:
payload – dict or list | original response from Amazon
errors – any | contains possible error messages
pagination – any | information about an endpoints pagination
headers – any | headers returned by the API
rate_limit – number | The x-amzn-RateLimit-Limit header, if available
next_token – str | The next token used to retrieve the next page, if any
kwargs – any