Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork243
Python wrapper to access the amazon selling partner API
License
saleweaver/python-amazon-sp-api
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A wrapper to accessAmazon's Selling Partner API with an easy-to-use interface.
Version 2 is currently being built - featuring pydantic, async support and better versioning.Check out v2-alpha here:v2-alpha
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
- 🌐 BTC Address:
bc1q6uqgczasmnvnc5upumarugw2mksnwneg0f65ws
- 🌐 ETH Address:
0xf59534F7a7F5410DBCD0c779Ac3bB6503bd32Ae5
Your support helps keep the project alive and evolving, and is greatly appreciated!
Documentation is availablehere
If you have questions, please ask them in GitHub discussions
or
pip install python-amazon-sp-apipip 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
fromsp_api.apiimportOrdersfromsp_api.apiimportReportsfromsp_api.apiimportDataKioskfromsp_api.apiimportFeedsfromsp_api.baseimportSellingApiExceptionfromsp_api.base.reportTypesimportReportTypefromdatetimeimportdatetime,timedelta# DATA KIOSK APIclient=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 APItry:res=Orders().get_orders(CreatedAfter=(datetime.utcnow()-timedelta(days=7)).isoformat())print(res.payload)# json dataexceptSellingApiExceptionasex:print(ex)# report requestcreate_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_feedFeeds().submit_feed(<feed_type>,<file_or_bytes_io>,content_type='text/tsv',**kwargs)# PII DataOrders(restricted_data_token='<token>').get_orders(CreatedAfter=(datetime.utcnow()-timedelta(days=7)).isoformat())# or use the shortcutorders=Orders().get_orders(LastUpdatedAfter=(datetime.utcnow()-timedelta(days=1)).isoformat())
You can create a new endpoint file by runningmake_endpoint <model_json_url>
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.
You can use nearly the same client for the Amazon Advertising API.@denisneuf has builtPython-Amazon-Advertising-API on top of this client.Check it outhere
We are not affiliated with Amazon
The client is pretty extensible and can be used for any other API. Check it out here:
About
Python wrapper to access the amazon selling partner API
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.