This Flask app simplifies downloading reports from the Amazon Seller Partner API and Amazon Ads API, aiding integration with tools like Power BI.
- OAuth2 authentication
- Token and profile caching
- Supports Sponsored Products (SP) and Sponsored Display (SD) reports
- Easy Power BI integration
-
Clone the Repository
git clone https://github.com/yourusername/amazon-advertising-report-middleware.git cd amazon-advertising-report-middleware
-
Set Up Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: `venv\Scripts\activate`
-
Install Dependencies
pip install -r requirements.txt
-
Configure Environment Variables Create a
.env
file in the project directory with the following content:AD_API_CLIENT_ID=<your_client_id> AD_API_CLIENT_SECRET=<your_client_secret>
-
Initialize the Database
python -c "from app import init_db; init_db()"
-
Run the Application
python app.py
Navigate to http://127.0.0.1:5000/authorize
to initiate the OAuth2 authorization process.
Call the endpoint GET /get-profiles
to retrieve and cache your Amazon Advertising profiles.
Use the GET /get-ad-report
endpoint to request specific advertising reports.
To request a Sponsored Display report:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE
file for more details.