Releases: denisneuf/python-amazon-ad-api
v0.1.3
Support for environment variables
import os
os.environ.setdefault('AD_API_REFRESH_TOKEN', 'Your-Token-Here')
os.environ.setdefault('AD_API_CLIENT_ID', 'Your-Client_Id-Here')
os.environ.setdefault('AD_API_CLIENT_SECRET', 'Your-Client_Secret-Here')
os.environ.setdefault('AD_API_PROFILE_ID', 'Your-Profile_Id-Here')
Support for Default marketplace operations
os.environ.setdefault('AD_API_DEFAULT_MARKETPLACE', 'DE')
***Default Marketplace if not set is Marketplaces.EU which covers (ES, FR, DE, UK, IT)
Solved Problem Installation
pytest
requests~=2.26.0
six>=1.16,<2
cachetools~=4.2.4
setuptools~=58.0.4
pycryptodome~=3.11.0
python-dotenv~=0.19.1
pytz~=2021.3
confuse~=1.6.0
v0.1.2
v0.1.0
Added support for Sponsored Display Advertising Modules:
- Campaigns
- Ad Groups
Added Debug
Added a kwarg parameter debug=True will provide log info about header sent, method and URL and raw Response. Example:
try:
states = 'enabled'
result = Campaigns(debug=True).list_campaigns_extended(
stateFilter=states
)
logging.info(result.payload)
except AdvertisingApiException as error:
logging.info(ex)
Will return:
Header:
INFO:{'User-Agent': 'python-ad-api-0.1.0', 'Amazon-Advertising-API-ClientId': 'Your-Client-ID', 'Authorization': 'Bearer Your-Token', 'Amazon-Advertising-API-Scope': 'Your-Scope', 'Content-Type': 'application/json'}
Method URL:
INFO:GET https://advertising-api-test.amazon.com/v2/sp/campaigns/extended
Raw Response:
INFO:{'_content': b'[{"campaignId":215197523378948,"name":"CAMPAIGN.TEST.AD.API.SANDBOX.MANUAL.011","campaignType":"sponsoredProducts","targetingType":"manual","premiumBidAdjustment":false,"dailyBudget":20.0,"startDate":"20211201","state":"enabled","bidding":{"strategy":"legacyForSales","adjustments":[]},"portfolioId":214026997044134,"tags":{"PONumber":"10322924","accountManager":"Manager-ES"},"servingStatus":"PENDING_START_DATE","creationDate":1635272586000,"lastUpdatedDate":1635272586000}]', '_content_consumed': True, '_next': None, 'status_code': 200, 'headers': {'Server': 'Server', 'Date': 'Tue, 09 Nov 2021 15:51:39 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'x-amz-rid': '1CN2T09DBD8KF94501D1', 'x-amz-request-id': '1CN2T09DBD81925701D1', 'Vary': 'Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent', 'Permissions-Policy': 'interest-cohort=()'}, 'raw': <urllib3.response.HTTPResponse object at 0x1062610d0>, 'url': 'https://advertising-api-test.amazon.com/v2/sp/campaigns/extended?stateFilter=enabled', 'encoding': 'utf-8', 'history': [], 'reason': '', 'cookies': <RequestsCookieJar[]>, 'elapsed': datetime.timedelta(seconds=2, microseconds=379280), 'request': <PreparedRequest [GET]>, 'connection': <requests.adapters.HTTPAdapter object at 0x106201c10>}
Added Marketplaces Missing:
North America (NA, US, CA, MX)
Far East (JP, AU)
Europe (UK alias GB, AE) EU can be used as wildcard when currency is EUR
Thanks to @mkdir700