Python Amazon Advertising API documentation

This project helps you using python 3.8 to use the Python Amazon Advertising API.

Note

The Sponsored Brands 4.0 contract is covered end to end, including budget rules, optimization rules, targeting categories, migration and the collection creatives. The 3.0 campaigns and ad groups remain only as reference: Amazon answers 403 Endpoint has been deprecated and points to 4.0.

Note

Most per-product routes take a versioned media type and the service routes on it. Sending application/json where a versioned type is expected answers 404 Could not find resource, which reads like a missing route but is only the wrong media type.

import logging
from ad_api.base import AdvertisingApiException
from ad_api.api.sp import Campaigns

logging.basicConfig(level=logging.DEBUG, format="%(asctime)s:%(levelname)s:%(message)s")

try:
    states = 'enabled'
    result = Campaigns().list_campaigns_extended_request(stateFilter=states)

    campaigns = result.payload
    for campaign in campaigns:
        logging.info(campaign)


except AdvertisingApiException as e:
    logging.error(e)