Python SDK for Selling Partner API
Click on the image to watch the video.
The Selling Partner API SDK for Python enables you to easily connect your Python application to Amazon's REST-based Selling Partner API.
Getting started
Credentials
Before you can use the SDK, you need to be registered as a Selling Partner API developer. If you haven't done that yet, please follow the instructions in the SP-API Registration Overview. You also need to register your application to get valid credentials to call SP-API. If you haven't done that yet, please follow the instructions in Registering your Application. If you are already registered successfully, you can find instructions on how to view your credentials in Viewing your Application Information and Credentials.
Minimum requirements
To run the SDK you need Python version 3.9 or higher.
Install the SDK
- Find the latest version number here.
- Add the dependency to your project
Using pip:
pip install amzn-sp-api
Add to your project requirements.txt
Add the following line to the requirements.txt file if needed:
amzn-sp-api >= "1.0.0"
Use the SDK
In order to call one of the APIs included in the Selling Partner API, you need to:
- Configure credentials (Note: Use your individual credentials for
clientId,clientSecretandrefreshToken). You can also configure the region and the authorization scope at this level. - Initialize the SPAPI Client using the configuration created in the previous step
- Create an instance for a specific API using the API client created
- Call an API operation
For example, refer to the following sample code for connecting to Sellers API.
from spapi import SellersApi, SPAPIConfig, SPAPIClient, ApiException
from spapi.models.sellers_v1 import GetMarketplaceParticipationsResponse
if __name__ == "__main__":
# Credentials configuration
config = SPAPIConfig(
client_id="",
client_secret="",
refresh_token="",
region="NA",
scope = None
)
# Create the API Client with configuration
client = SPAPIClient(config)
sellers_api = SellersApi(client.api_client)
response = None
try:
response = sellers_api.get_marketplace_participations()
except ApiException as e:
print(f"API Exception occurred: {str(e)}")
if response is not None:
print("Sellers API Response:")
get_marketplace_participations_response = GetMarketplaceParticipationsResponse(response.payload)
for marketplaceParticipation in get_marketplace_participations_response.payload:
print(marketplaceParticipation.marketplace.id)
Note: Code can be found under python/sample-app folder
Giving Feedback
We need your help in making this SDK great. Please participate in the community and contribute to this effort by submitting issues, participating in discussion forums and submitting pull requests through the following channels:
Submit issues - this is the preferred channel to interact with our team Articulate your feature request or upvote existing ones on our Issues page
Metadata
Release files for amzn-sp-api 1.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| amzn_sp_api-1.14.0.tar.gz | 1.2 MB | Without provenance | Details for amzn_sp_api-1.14.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| amzn_sp_api-1.14.0-py3-none-any.whl | Python 3 | none | any | Details for amzn_sp_api-1.14.0-py3-none-any.whl |
Total release size: 5.2 MB
Release files / amzn_sp_api-1.14.0.tar.gz
| Download URL | amzn_sp_api-1.14.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
836e1748cbbbed7999e1bff4b530dac2754a379ed6e872cfa12997e3bd3f83f2
|
|
BLAKE2b-256 checksum How to use checksums |
e63bcbf55852c329238b1f15a0c3e5ebc19d944180a7fbda18745a712b1ba03b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / amzn_sp_api-1.14.0-py3-none-any.whl
| Download URL | amzn_sp_api-1.14.0-py3-none-any.whl |
|---|---|
| Size | 4.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e5d9e350fa2aa4246d56f8f0796e314a68746acd81c05c9b582996f27560eaf
|
|
BLAKE2b-256 checksum How to use checksums |
165225860353510ae6cb2a506f94b54dfe5cd79fa6b40a1dbb42c658525a4ac3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for amzn-sp-api 1.14.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.