[](https://pepy.tech/project/python-amazon-sp-api)
[](https://pepy.tech/project/python-amazon-sp-api)
[](https://pepy.tech/project/python-amazon-sp-api)
# PYTHON-AMAZON-SP-API
## Amazon Selling-Partner API
A wrapper to access **Amazon's Selling Partner API** with an easy-to-use interface.
---
### 🚀 Version 2 🚀
Version 2 is currently being built - featuring pydantic, async support and better versioning.
Check out v2-alpha here: [v2-alpha](https://github.com/saleweaver/python-amazon-sp-api/tree/v2-01)
---
# 🌟 Thank you for using python-amazon-sp-api! 🌟
This tool helps developers and businesses connect seamlessly with Amazon's vast marketplace, enabling powerful automations and data management.
If you appreciate this project and find it useful, please consider supporting its continued development:
- 🙌 [GitHub Sponsors](https://github.com/sponsors/saleweaver)
- 🌐 BTC Address: `bc1q6uqgczasmnvnc5upumarugw2mksnwneg0f65ws`
- 🌐 ETH Address: `0xf59534F7a7F5410DBCD0c779Ac3bB6503bd32Ae5`
Your support helps keep the project alive and evolving, and is greatly appreciated!
----
### Documentation
Documentation is available [here](https://python-amazon-sp-api.readthedocs.io/en/latest/)
[](https://python-amazon-sp-api.readthedocs.io/en/latest/index.html)
### Q & A
If you have questions, please ask them in GitHub discussions
[](https://github.com/saleweaver/python-amazon-sp-api/discussions)
or
[](https://join.slack.com/t/sellingpartnerapi/shared_invite/zt-zovn6tch-810j9dBPQtJsvw7lEXSuaQ)
### Installation
[](https://pypi.org/project/python-amazon-sp-api/)
```
pip install python-amazon-sp-api
pip install "python-amazon-sp-api[aws]" # if you want to use AWS Secret Manager Authentication.
pip install "python-amazon-sp-api[aws-caching]" # if you want to use the Cached Secrets from AWS
```
---
### Usage
```python
from sp_api.api import Orders
from sp_api.api import Reports
from sp_api.api import DataKiosk
from sp_api.api import Feeds
from sp_api.base import SellingApiException
from sp_api.base.reportTypes import ReportType
from datetime import datetime, timedelta
# DATA KIOSK API
client = DataKiosk()
res = client.create_query(query="{analytics_salesAndTraffic_2023_11_15{salesAndTrafficByAsin(startDate:\"2022-09-01\" endDate:\"2022-09-30\" aggregateBy:SKU marketplaceIds:[\"ATVPDKIKX0DER\"]){childAsin endDate marketplaceId parentAsin sales{orderedProductSales{amount currencyCode}totalOrderItems totalOrderItemsB2B}sku startDate traffic{browserPageViews browserPageViewsB2B browserPageViewsPercentage browserPageViewsPercentageB2B browserSessionPercentage unitSessionPercentageB2B unitSessionPercentage}}}}")
print(res)
# orders API
try:
res = Orders().get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())
print(res.payload) # json data
except SellingApiException as ex:
print(ex)
# report request
create_report_response = Reports().create_report(reportType=ReportType.GET_MERCHANT_LISTINGS_ALL_DATA)
# submit feed
# feeds can be submitted like explained in Amazon's docs, or simply by calling submit_feed
Feeds().submit_feed(<feed_type>, <file_or_bytes_io>, content_type='text/tsv', **kwargs)
# PII Data
Orders(restricted_data_token='<token>').get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())
# or use the shortcut
orders = Orders().get_orders(
LastUpdatedAfter=(datetime.utcnow() - timedelta(days=1)).isoformat()
)
```
---
### New endpoints
You can create a new endpoint file by running `make_endpoint <model_json_url>`
```bash
make_endpoint https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/listings-restrictions-api-model/listingsRestrictions_2021-08-01.json
```
This creates a ready to use client. Please consider creating a pull request with the new code.
### ADVERTISING API
You can use nearly the same client for the Amazon Advertising API. [@denisneuf](https://github.com/denisneuf) has built [Python-Amazon-Advertising-API](https://github.com/denisneuf/python-amazon-ad-api) on top of this client.
Check it out [here](https://github.com/denisneuf/python-amazon-ad-api)
### DISCLAIMER
We are not affiliated with Amazon
### LICENSE

---
### Base Client
The client is pretty extensible and can be used for any other API. Check it out here:
[API Client](https://github.com/saleweaver/rapid_rest_client)

Raw data
{
"_id": null,
"home_page": "https://github.com/saleweaver/python-amazon-sp-api",
"name": "python-amazon-sp-api",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Michael",
"author_email": "primke.michael@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/98/f0/5bc54334df0e8e2f7dc200a56dfd78c0c68a19befe273dc185bcbfcfb1e0/python_amazon_sp_api-1.9.40.tar.gz",
"platform": null,
"description": "[](https://pepy.tech/project/python-amazon-sp-api)\n[](https://pepy.tech/project/python-amazon-sp-api)\n[](https://pepy.tech/project/python-amazon-sp-api)\n\n# PYTHON-AMAZON-SP-API\n\n## Amazon Selling-Partner API\n\nA wrapper to access **Amazon's Selling Partner API** with an easy-to-use interface.\n\n---\n\n### \ud83d\ude80 Version 2 \ud83d\ude80\n\nVersion 2 is currently being built - featuring pydantic, async support and better versioning. \nCheck out v2-alpha here: [v2-alpha](https://github.com/saleweaver/python-amazon-sp-api/tree/v2-01) \n\n---\n\n# \ud83c\udf1f Thank you for using python-amazon-sp-api! \ud83c\udf1f\n\nThis tool helps developers and businesses connect seamlessly with Amazon's vast marketplace, enabling powerful automations and data management.\n\nIf you appreciate this project and find it useful, please consider supporting its continued development:\n\n- \ud83d\ude4c [GitHub Sponsors](https://github.com/sponsors/saleweaver)\n- \ud83c\udf10 BTC Address: `bc1q6uqgczasmnvnc5upumarugw2mksnwneg0f65ws`\n- \ud83c\udf10 ETH Address: `0xf59534F7a7F5410DBCD0c779Ac3bB6503bd32Ae5`\n\nYour support helps keep the project alive and evolving, and is greatly appreciated!\n\n\n----\n\n### Documentation\n\nDocumentation is available [here](https://python-amazon-sp-api.readthedocs.io/en/latest/)\n\n[](https://python-amazon-sp-api.readthedocs.io/en/latest/index.html)\n\n\n### Q & A\n\nIf you have questions, please ask them in GitHub discussions \n\n[](https://github.com/saleweaver/python-amazon-sp-api/discussions)\n\nor\n\n[](https://join.slack.com/t/sellingpartnerapi/shared_invite/zt-zovn6tch-810j9dBPQtJsvw7lEXSuaQ)\n\n\n### Installation\n[](https://pypi.org/project/python-amazon-sp-api/)\n```\npip install python-amazon-sp-api\npip install \"python-amazon-sp-api[aws]\" # if you want to use AWS Secret Manager Authentication.\npip install \"python-amazon-sp-api[aws-caching]\" # if you want to use the Cached Secrets from AWS\n```\n\n---\n### Usage\n\n```python\nfrom sp_api.api import Orders\nfrom sp_api.api import Reports\nfrom sp_api.api import DataKiosk\nfrom sp_api.api import Feeds\nfrom sp_api.base import SellingApiException\nfrom sp_api.base.reportTypes import ReportType\nfrom datetime import datetime, timedelta\n\n# DATA KIOSK API\nclient = DataKiosk()\n\nres = client.create_query(query=\"{analytics_salesAndTraffic_2023_11_15{salesAndTrafficByAsin(startDate:\\\"2022-09-01\\\" endDate:\\\"2022-09-30\\\" aggregateBy:SKU marketplaceIds:[\\\"ATVPDKIKX0DER\\\"]){childAsin endDate marketplaceId parentAsin sales{orderedProductSales{amount currencyCode}totalOrderItems totalOrderItemsB2B}sku startDate traffic{browserPageViews browserPageViewsB2B browserPageViewsPercentage browserPageViewsPercentageB2B browserSessionPercentage unitSessionPercentageB2B unitSessionPercentage}}}}\")\nprint(res)\n\n# orders API\ntry:\n res = Orders().get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())\n print(res.payload) # json data\nexcept SellingApiException as ex:\n print(ex)\n\n\n# report request \ncreate_report_response = Reports().create_report(reportType=ReportType.GET_MERCHANT_LISTINGS_ALL_DATA)\n\n# submit feed\n# feeds can be submitted like explained in Amazon's docs, or simply by calling submit_feed\n\nFeeds().submit_feed(<feed_type>, <file_or_bytes_io>, content_type='text/tsv', **kwargs)\n\n# PII Data\n\nOrders(restricted_data_token='<token>').get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())\n\n# or use the shortcut\norders = Orders().get_orders(\n LastUpdatedAfter=(datetime.utcnow() - timedelta(days=1)).isoformat()\n)\n```\n\n---\n\n\n### New endpoints\n\nYou can create a new endpoint file by running `make_endpoint <model_json_url>`\n\n```bash\nmake_endpoint https://raw.githubusercontent.com/amzn/selling-partner-api-models/main/models/listings-restrictions-api-model/listingsRestrictions_2021-08-01.json\n```\n\nThis creates a ready to use client. Please consider creating a pull request with the new code.\n\n\n### ADVERTISING API\n\nYou can use nearly the same client for the Amazon Advertising API. [@denisneuf](https://github.com/denisneuf) has built [Python-Amazon-Advertising-API](https://github.com/denisneuf/python-amazon-ad-api) on top of this client.\nCheck it out [here](https://github.com/denisneuf/python-amazon-ad-api)\n\n### DISCLAIMER\n\nWe are not affiliated with Amazon\n\n\n### LICENSE\n\n\n\n---\n\n### Base Client\n\nThe client is pretty extensible and can be used for any other API. Check it out here:\n\n[API Client](https://github.com/saleweaver/rapid_rest_client)\n\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python wrapper for the Amazon Selling-Partner API",
"version": "1.9.40",
"project_urls": {
"Homepage": "https://github.com/saleweaver/python-amazon-sp-api"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "92d4ae375c76505e47f601c487aff177df6b8513e21c13850ebe78766ca44cff",
"md5": "026687124be87795c2b309b0567b1f53",
"sha256": "6629a8cee6effcd33fb956bcbcdb314539df4f594ce6613fea99e8ba88046fec"
},
"downloads": -1,
"filename": "python_amazon_sp_api-1.9.40-py3-none-any.whl",
"has_sig": false,
"md5_digest": "026687124be87795c2b309b0567b1f53",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 140005,
"upload_time": "2025-07-26T07:43:41",
"upload_time_iso_8601": "2025-07-26T07:43:41.722534Z",
"url": "https://files.pythonhosted.org/packages/92/d4/ae375c76505e47f601c487aff177df6b8513e21c13850ebe78766ca44cff/python_amazon_sp_api-1.9.40-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "98f05bc54334df0e8e2f7dc200a56dfd78c0c68a19befe273dc185bcbfcfb1e0",
"md5": "865e25e71bc06130211d9c951ea6fb0c",
"sha256": "de2b27f7861f66214a0b6d5f1fac20beeea7355a9b3ca9b4899702fe916f380f"
},
"downloads": -1,
"filename": "python_amazon_sp_api-1.9.40.tar.gz",
"has_sig": false,
"md5_digest": "865e25e71bc06130211d9c951ea6fb0c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 95310,
"upload_time": "2025-07-26T07:43:43",
"upload_time_iso_8601": "2025-07-26T07:43:43.446272Z",
"url": "https://files.pythonhosted.org/packages/98/f0/5bc54334df0e8e2f7dc200a56dfd78c0c68a19befe273dc185bcbfcfb1e0/python_amazon_sp_api-1.9.40.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-26 07:43:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "saleweaver",
"github_project": "python-amazon-sp-api",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "pytest",
"specs": []
},
{
"name": "requests",
"specs": [
[
"~=",
"2.32.4"
]
]
},
{
"name": "boto3",
"specs": [
[
"~=",
"1.39.13"
]
]
},
{
"name": "cachetools",
"specs": [
[
"~=",
"5.5.2"
]
]
},
{
"name": "setuptools",
"specs": [
[
"~=",
"80.9.0"
]
]
},
{
"name": "pytz",
"specs": [
[
"~=",
"2025.1"
]
]
},
{
"name": "confuse",
"specs": [
[
"~=",
"2.0.1"
]
]
},
{
"name": "jinja2",
"specs": []
}
],
"lcname": "python-amazon-sp-api"
}