python-amazon-ad-api 0.9.7__tar.gz → 0.9.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/PKG-INFO +35 -3
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/README.md +34 -2
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/__init__.py +2 -0
- python_amazon_ad_api-0.9.9/ad_api/api/sp/campaigns.py +398 -0
- python_amazon_ad_api-0.9.9/ad_api/version.py +1 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/python_amazon_ad_api.egg-info/PKG-INFO +35 -3
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/setup.cfg +1 -1
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/setup.py +1 -1
- python_amazon_ad_api-0.9.7/ad_api/api/sp/campaigns.py +0 -428
- python_amazon_ad_api-0.9.7/ad_api/version.py +0 -1
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/LICENSE +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/__init__.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/account.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/advertising_test_account.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/attribution.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/audiences.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/billing.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/brand_metrics.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/creative_assets.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/dsp/__init__.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/dsp/access_token_client.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/dsp/client.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/dsp/credential_provider.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/dsp/reports.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/eligibility.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/exports.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/history.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/insights.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/invoices.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/localization.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/manager_accounts.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/metadata.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/portfolios.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/portfolios_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/profiles.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/reports.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/__init__.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/ad_creatives_v4.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/ad_groups.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/ad_groups_v4.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/ads_v4.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/benchmarks.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/bid_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/brands.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/campaigns.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/campaigns_v4.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/forecast.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/keywords.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/keywords_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/landing_page_asins.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/media.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/moderation.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/negative_keywords.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/negative_product_targeting.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/product_targeting.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/reports.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/snapshots.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/stores.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/targeting_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sb/themes.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/__init__.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/ad_groups.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/bid_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/brand_safety.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/budget_rules.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/campaigns.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/campaigns_budget_usage.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/creatives.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/forecast.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/negative_product_targeting.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/product_ads.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/product_targeting.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/reports.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/snapshots.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sd/targeting_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/__init__.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/ad_groups.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/ad_groups_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/bid_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/bid_recommendations_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/budget_initial_recommendation.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/budget_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/budget_rules.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/budget_rules_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/campaign_consolidated_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/campaign_negative_keywords.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/campaign_negative_keywords_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/campaign_negative_targets.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/campaigns_budget_usage.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/campaigns_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/campaings_optimization.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/keywords.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/keywords_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/negative_keywords.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/negative_keywords_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/negative_product_targeting.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/negative_product_targeting_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/product_ads.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/product_ads_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/product_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/product_targeting.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/product_targeting_v3.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/ranked_keywords_recommendations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/reports.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/schedule_based_bid_optimization.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/snapshots.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/sp/suggested_keywords.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/stores.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/stream.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/api/validation_configurations.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/auth/__init__.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/auth/access_token_client.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/auth/access_token_response.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/auth/credentials.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/auth/exceptions.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/__init__.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/api_response.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/base_client.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/client.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/config.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/credential_provider.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/exceptions.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/helpers.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/marketplaces.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/ad_api/base/utils.py +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/pyproject.toml +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/python_amazon_ad_api.egg-info/SOURCES.txt +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/python_amazon_ad_api.egg-info/dependency_links.txt +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/python_amazon_ad_api.egg-info/requires.txt +0 -0
- {python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/python_amazon_ad_api.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-amazon-ad-api
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.9
|
|
4
4
|
Summary: Python wrapper for the Amazon Advertising API
|
|
5
5
|
Home-page: https://github.com/denisneuf/python-amazon-ad-api
|
|
6
6
|
Author: Daniel Alvaro
|
|
@@ -299,6 +299,34 @@ There is a new version 3 Portfolios API, please check the [migration guide](http
|
|
|
299
299
|
* [Get test account information](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_test_account.html#ad_api.api.AdvertisingTestAccount.AdvertisingTestAccount.get_test_account)
|
|
300
300
|
|
|
301
301
|
|
|
302
|
+
### Sponsored Products v1 (new)
|
|
303
|
+
|
|
304
|
+
New unified endpoint generation. Campaigns are queried with a single `POST /adsApi/v1/query/campaigns` resource instead of the versioned v2/v3 endpoints.
|
|
305
|
+
|
|
306
|
+
| Method | Endpoint | Body |
|
|
307
|
+
|---|---|---|
|
|
308
|
+
| `query_campaigns` | `POST /adsApi/v1/query/campaigns` | filters + `maxResults`/`nextToken` |
|
|
309
|
+
| `create_campaigns` | `POST /adsApi/v1/create/campaigns` | `campaigns[]` (`adProduct`, `name`, `state` required) |
|
|
310
|
+
| `update_campaigns` | `POST /adsApi/v1/update/campaigns` | `campaigns[]` (`campaignId` required) |
|
|
311
|
+
| `delete_campaigns` | `POST /adsApi/v1/delete/campaigns` | `campaignIds[]` |
|
|
312
|
+
|
|
313
|
+
All four return a **207 MultiStatus** response (except `query_campaigns`, which returns 200), so check the payload for per-entity errors.
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
from ad_api.api import sponsored_products
|
|
317
|
+
|
|
318
|
+
result = sponsored_products.Campaigns(credentials=credentials, debug=True).query_campaigns(
|
|
319
|
+
body={
|
|
320
|
+
"adProductFilter": {"include": ["SPONSORED_PRODUCTS"]},
|
|
321
|
+
"stateFilter": {"include": ["ENABLED"]},
|
|
322
|
+
"maxResults": 100,
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
campaigns = result.payload.get("campaigns")
|
|
327
|
+
next_token = result.payload.get("nextToken")
|
|
328
|
+
```
|
|
329
|
+
|
|
302
330
|
### [Modules Available Sponsored Products 2.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sp_v2.html)
|
|
303
331
|
|
|
304
332
|
Warning: [PLANNED DEPRECATION 6/30/2023]
|
|
@@ -307,6 +335,8 @@ There is a new version 3 of Sponsored Product API, please check the [migration g
|
|
|
307
335
|
|
|
308
336
|
### [Modules Available Sponsored Products 3.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sp_v3.html)
|
|
309
337
|
|
|
338
|
+
Warning: `list_campaigns` is deprecated. Use the v1 `query_campaigns` method instead.
|
|
339
|
+
|
|
310
340
|
|
|
311
341
|
* [ThemeBased Bid Recommendation](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/bid_recommendations_v3.html)
|
|
312
342
|
* [Keyword Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/ranked_keywords_recommendations.html)
|
|
@@ -375,7 +405,9 @@ There is a new version 3 of Sponsored Product API, please check the [migration g
|
|
|
375
405
|
|
|
376
406
|
* [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/dsp/reports.html)
|
|
377
407
|
|
|
378
|
-
### Simple Example Usage Campaigns with Credentials
|
|
408
|
+
### Simple Example Usage Campaigns with Credentials (v3, legacy)
|
|
409
|
+
|
|
410
|
+
Warning: this example uses `CampaignsV3.list_campaigns`, which is deprecated. See the v1 `query_campaigns` example above.
|
|
379
411
|
|
|
380
412
|
```python
|
|
381
413
|
import logging
|
|
@@ -443,4 +475,4 @@ We are not affiliated with Amazon but they used our api :)
|
|
|
443
475
|
|
|
444
476
|
|
|
445
477
|
---
|
|
446
|
-
*Last release: v0.
|
|
478
|
+
*Last release: v0.9.7*
|
|
@@ -271,6 +271,34 @@ There is a new version 3 Portfolios API, please check the [migration guide](http
|
|
|
271
271
|
* [Get test account information](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_test_account.html#ad_api.api.AdvertisingTestAccount.AdvertisingTestAccount.get_test_account)
|
|
272
272
|
|
|
273
273
|
|
|
274
|
+
### Sponsored Products v1 (new)
|
|
275
|
+
|
|
276
|
+
New unified endpoint generation. Campaigns are queried with a single `POST /adsApi/v1/query/campaigns` resource instead of the versioned v2/v3 endpoints.
|
|
277
|
+
|
|
278
|
+
| Method | Endpoint | Body |
|
|
279
|
+
|---|---|---|
|
|
280
|
+
| `query_campaigns` | `POST /adsApi/v1/query/campaigns` | filters + `maxResults`/`nextToken` |
|
|
281
|
+
| `create_campaigns` | `POST /adsApi/v1/create/campaigns` | `campaigns[]` (`adProduct`, `name`, `state` required) |
|
|
282
|
+
| `update_campaigns` | `POST /adsApi/v1/update/campaigns` | `campaigns[]` (`campaignId` required) |
|
|
283
|
+
| `delete_campaigns` | `POST /adsApi/v1/delete/campaigns` | `campaignIds[]` |
|
|
284
|
+
|
|
285
|
+
All four return a **207 MultiStatus** response (except `query_campaigns`, which returns 200), so check the payload for per-entity errors.
|
|
286
|
+
|
|
287
|
+
```python
|
|
288
|
+
from ad_api.api import sponsored_products
|
|
289
|
+
|
|
290
|
+
result = sponsored_products.Campaigns(credentials=credentials, debug=True).query_campaigns(
|
|
291
|
+
body={
|
|
292
|
+
"adProductFilter": {"include": ["SPONSORED_PRODUCTS"]},
|
|
293
|
+
"stateFilter": {"include": ["ENABLED"]},
|
|
294
|
+
"maxResults": 100,
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
campaigns = result.payload.get("campaigns")
|
|
299
|
+
next_token = result.payload.get("nextToken")
|
|
300
|
+
```
|
|
301
|
+
|
|
274
302
|
### [Modules Available Sponsored Products 2.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sp_v2.html)
|
|
275
303
|
|
|
276
304
|
Warning: [PLANNED DEPRECATION 6/30/2023]
|
|
@@ -279,6 +307,8 @@ There is a new version 3 of Sponsored Product API, please check the [migration g
|
|
|
279
307
|
|
|
280
308
|
### [Modules Available Sponsored Products 3.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sp_v3.html)
|
|
281
309
|
|
|
310
|
+
Warning: `list_campaigns` is deprecated. Use the v1 `query_campaigns` method instead.
|
|
311
|
+
|
|
282
312
|
|
|
283
313
|
* [ThemeBased Bid Recommendation](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/bid_recommendations_v3.html)
|
|
284
314
|
* [Keyword Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/ranked_keywords_recommendations.html)
|
|
@@ -347,7 +377,9 @@ There is a new version 3 of Sponsored Product API, please check the [migration g
|
|
|
347
377
|
|
|
348
378
|
* [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/dsp/reports.html)
|
|
349
379
|
|
|
350
|
-
### Simple Example Usage Campaigns with Credentials
|
|
380
|
+
### Simple Example Usage Campaigns with Credentials (v3, legacy)
|
|
381
|
+
|
|
382
|
+
Warning: this example uses `CampaignsV3.list_campaigns`, which is deprecated. See the v1 `query_campaigns` example above.
|
|
351
383
|
|
|
352
384
|
```python
|
|
353
385
|
import logging
|
|
@@ -415,4 +447,4 @@ We are not affiliated with Amazon but they used our api :)
|
|
|
415
447
|
|
|
416
448
|
|
|
417
449
|
---
|
|
418
|
-
*Last release: v0.
|
|
450
|
+
*Last release: v0.9.7*
|
|
@@ -12,6 +12,7 @@ from .audiences import Audiences
|
|
|
12
12
|
from .portfolios import Portfolios
|
|
13
13
|
from .portfolios_v3 import PortfoliosV3
|
|
14
14
|
from .insights import Insights
|
|
15
|
+
from . import v1
|
|
15
16
|
from . import sp as sponsored_products
|
|
16
17
|
from . import sb as sponsored_brands
|
|
17
18
|
from . import sd as sponsored_display
|
|
@@ -26,6 +27,7 @@ from .exports import Exports
|
|
|
26
27
|
from .stores import Stores
|
|
27
28
|
|
|
28
29
|
__all__ = [
|
|
30
|
+
"v1",
|
|
29
31
|
"sp",
|
|
30
32
|
"sb",
|
|
31
33
|
"sd",
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Campaigns(Client):
|
|
6
|
+
r"""
|
|
7
|
+
Campaigns(account='default', marketplace: Marketplaces = Marketplaces.EU, credentials=None, debug=False)
|
|
8
|
+
|
|
9
|
+
Amazon Ads API - Sponsored Products
|
|
10
|
+
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
14
|
+
# @sp_endpoint('/v2/sp/campaigns', method='PUT')
|
|
15
|
+
# @Utils.deprecated
|
|
16
|
+
# def edit_single_campaign_assistant(
|
|
17
|
+
# self,
|
|
18
|
+
# campaign_id: int,
|
|
19
|
+
# portfolio_id: int = None,
|
|
20
|
+
# campaign_name: str = None,
|
|
21
|
+
# po_number: str = None,
|
|
22
|
+
# account_manager: str = None,
|
|
23
|
+
# campaign_status: str = None,
|
|
24
|
+
# daily_budget: int = None,
|
|
25
|
+
# start_date: str = None,
|
|
26
|
+
# end_date: str = None,
|
|
27
|
+
# premium_bid_adjustment: bool = None,
|
|
28
|
+
# strategy: str = None,
|
|
29
|
+
# predicate: str or tuple = None,
|
|
30
|
+
# percentage: str or tuple = None,
|
|
31
|
+
# **kwargs,
|
|
32
|
+
# ) -> ApiResponse:
|
|
33
|
+
# r"""
|
|
34
|
+
# edit_single_campaign_assistant(campaign_id: int, portfolio_id: int = None, campaign_name: str, po_number: str = None, account_manager: str = None, campaign_status: str = None, daily_budget: int, start_date: str, end_date: str = None, premium_bid_adjustment: bool = None, strategy:str = None, predicate:str or tuple = None, percentage:int or tuple = None, **kwargs) -> ApiResponse
|
|
35
|
+
#
|
|
36
|
+
# Edit one campaigns and create the body based on the params provided, at least one of the optional params need to be set or a INVALID_ARGUMENT code is thorwn
|
|
37
|
+
#
|
|
38
|
+
# Kwargs:
|
|
39
|
+
# | **campaign_id** (number): [required] The identifier of an existing campaign to update.
|
|
40
|
+
# | **portfolio_id** (number): [optional] The identifier of an existing portfolio to which the campaign is associated
|
|
41
|
+
# | **campaign_name** (string): [optional] A name for the campaign
|
|
42
|
+
# | **po_number** (string): [optional] 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
|
|
43
|
+
# | **account_manager** (string): [optional] A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
|
|
44
|
+
# | **campaign_status**': (string): [optional] The current resource state Values: enabled, paused, archived. Default: enabled
|
|
45
|
+
# | **daily_budget** (float): [optional] A daily budget for the campaign
|
|
46
|
+
# | **start_date** (string): [optional] A starting date for the campaign to go live. The format of the date is YYYYMMDD
|
|
47
|
+
# | **end_date** (string): [optional] An ending date for the campaign to stop running. The format of the date is YYYYMMDD
|
|
48
|
+
# | **premium_bid_adjustment**' (boolean): [optional] If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information. Tip: When Campaign has been adopted to enhanced bidding premiumBidAdjustment can not be set
|
|
49
|
+
# | **strategy** (string): [optional] The bidding strategy. 'Values': legacyForSales (Dynamic bids - down only), autoForSales (Dynamic bids - up and down), manual (Fixed bid)
|
|
50
|
+
# | **predicate** (string or tuple(str)): [optional] You can enable controls to adjust your bid based on the placement location. Specify a location where you want to use bid controls. The percentage value set is the percentage of the original bid for which you want to have your bid adjustment increased. For example, a 50% adjustment on a $1.00 bid would increase the bid to $1.50 for the opportunity to win a specified placement. 'Values': placementTop (str), placementProductPage (str), ("placementTop", "placementProductPage") (tuple)
|
|
51
|
+
# | **percentage** (float or tuple(float)): [optional] The bid adjustment percentage value. Example: 15 (float), (15, 25) (tuple)
|
|
52
|
+
#
|
|
53
|
+
# Returns:
|
|
54
|
+
#
|
|
55
|
+
# ApiResponse
|
|
56
|
+
#
|
|
57
|
+
# """
|
|
58
|
+
#
|
|
59
|
+
# optional = {}
|
|
60
|
+
#
|
|
61
|
+
# if portfolio_id is not None:
|
|
62
|
+
# optional.update({'portfolioId': portfolio_id})
|
|
63
|
+
#
|
|
64
|
+
# if campaign_name is not None:
|
|
65
|
+
# optional.update({'name': campaign_name})
|
|
66
|
+
#
|
|
67
|
+
# if po_number is not None and account_manager is not None:
|
|
68
|
+
# optional.update({"tags": {'PONumber': po_number, 'accountManager': account_manager}})
|
|
69
|
+
#
|
|
70
|
+
# if campaign_status is not None:
|
|
71
|
+
# optional.update({'state': campaign_status})
|
|
72
|
+
#
|
|
73
|
+
# if daily_budget is not None:
|
|
74
|
+
# optional.update({'dailyBudget': daily_budget})
|
|
75
|
+
#
|
|
76
|
+
# if start_date is not None:
|
|
77
|
+
# optional.update({'startDate': start_date})
|
|
78
|
+
#
|
|
79
|
+
# if end_date is not None:
|
|
80
|
+
# optional.update({'endDate': end_date})
|
|
81
|
+
#
|
|
82
|
+
# if premium_bid_adjustment is not None:
|
|
83
|
+
# optional.update({'premiumBidAdjustment': premium_bid_adjustment})
|
|
84
|
+
#
|
|
85
|
+
# if strategy is not None and predicate is None and percentage is None:
|
|
86
|
+
# optional.update({'bidding': {'strategy': strategy, 'adjustments': []}})
|
|
87
|
+
#
|
|
88
|
+
# if strategy is not None and predicate is not None and percentage is not None:
|
|
89
|
+
# if isinstance(predicate, str):
|
|
90
|
+
# optional.update(
|
|
91
|
+
# {
|
|
92
|
+
# 'bidding': {
|
|
93
|
+
# 'strategy': strategy,
|
|
94
|
+
# 'adjustments': [{'predicate': predicate, 'percentage': percentage}],
|
|
95
|
+
# }
|
|
96
|
+
# }
|
|
97
|
+
# )
|
|
98
|
+
#
|
|
99
|
+
# if isinstance(predicate, tuple) and len(predicate) == 2 and len(percentage) == 2:
|
|
100
|
+
# options = []
|
|
101
|
+
# for i in range(len(predicate)):
|
|
102
|
+
# option = {"predicate": predicate[i], "percentage": percentage[i]}
|
|
103
|
+
# options.append(option)
|
|
104
|
+
#
|
|
105
|
+
# bidding = {'strategy': strategy, 'adjustments': options}
|
|
106
|
+
#
|
|
107
|
+
# dictionary = {}
|
|
108
|
+
# dictionary["bidding"] = bidding
|
|
109
|
+
#
|
|
110
|
+
# optional.update(dictionary)
|
|
111
|
+
#
|
|
112
|
+
# required = {
|
|
113
|
+
# 'campaignId': campaign_id,
|
|
114
|
+
# }
|
|
115
|
+
#
|
|
116
|
+
# if not optional:
|
|
117
|
+
# description = 'No changes submitted for entity %s' % campaign_id
|
|
118
|
+
# obj = [{'code': 'INVALID_ARGUMENT', 'description': description}]
|
|
119
|
+
# return ApiResponse(obj)
|
|
120
|
+
# else:
|
|
121
|
+
# required.update(optional)
|
|
122
|
+
# data_str = json.dumps([required])
|
|
123
|
+
# return self._request(kwargs.pop('path'), data=data_str, params=kwargs)
|
|
124
|
+
#
|
|
125
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
126
|
+
# @sp_endpoint('/v2/sp/campaigns', method='POST')
|
|
127
|
+
# @Utils.deprecated
|
|
128
|
+
# def create_single_campaign_assistant(
|
|
129
|
+
# self,
|
|
130
|
+
# campaign_name: str,
|
|
131
|
+
# targeting_type: str,
|
|
132
|
+
# daily_budget: int,
|
|
133
|
+
# start_date: str,
|
|
134
|
+
# end_date: str = None,
|
|
135
|
+
# campaign_status: str = "enabled",
|
|
136
|
+
# portfolio_id: int = None,
|
|
137
|
+
# po_number: str = None,
|
|
138
|
+
# account_manager: str = None,
|
|
139
|
+
# premium_bid_adjustment: bool = None,
|
|
140
|
+
# strategy: str = None,
|
|
141
|
+
# predicate: str or tuple = None,
|
|
142
|
+
# percentage: int or tuple = None,
|
|
143
|
+
# **kwargs,
|
|
144
|
+
# ) -> ApiResponse:
|
|
145
|
+
# r"""
|
|
146
|
+
# create_single_campaign_assistant(campaign_name: str,targeting_type: str, daily_budget: int, start_date: str, end_date: str = None, campaign_status: str = "enabled", portfolio_id: int = None, po_number: str = None, account_manager: str = None, premium_bid_adjustment: bool = False, strategy:str = None, predicate:str = None, percentage:int = None, **kwargs) -> ApiResponse
|
|
147
|
+
#
|
|
148
|
+
# Creates one campaigns and create the body based on the params provided
|
|
149
|
+
#
|
|
150
|
+
# Kwargs:
|
|
151
|
+
#
|
|
152
|
+
# | **campaign_name** (string): [required] A name for the campaign
|
|
153
|
+
# | **campaign_type** (string): [fixed] The advertising product managed by this campaign. Value: sponsoredProducts
|
|
154
|
+
# | **targeting_type** (string): [required] The type of targeting for the campaign. Values: manual, auto
|
|
155
|
+
# | **daily_budget** (float): [required] A daily budget for the campaign
|
|
156
|
+
# | **start_date** (string): [required] A starting date for the campaign to go live. The format of the date is YYYYMMDD
|
|
157
|
+
# | **end_date** (string): [optional] An ending date for the campaign to stop running. The format of the date is YYYYMMDD
|
|
158
|
+
# | **campaign_status**': (string): [optional] The current resource state Values: enabled, paused, archived. Default: enabled
|
|
159
|
+
# | **portfolio_id** (number): [optional] The identifier of an existing portfolio to which the campaign is associated
|
|
160
|
+
# | **po_number** (string): [optional] 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
|
|
161
|
+
# | **account_manager** (string): [optional] A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
|
|
162
|
+
# | **premium_bid_adjustment**' (boolean) If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.
|
|
163
|
+
# | **strategy** (string): [optional] The bidding strategy. 'Values': legacyForSales (Dynamic bids - down only), autoForSales (Dynamic bids - up and down), manual (Fixed bid)
|
|
164
|
+
# | **predicate** (string): [optional] You can enable controls to adjust your bid based on the placement location. Specify a location where you want to use bid controls. The percentage value set is the percentage of the original bid for which you want to have your bid adjustment increased. For example, a 50% adjustment on a $1.00 bid would increase the bid to $1.50 for the opportunity to win a specified placement. 'Values': placementTop, placementProductPage
|
|
165
|
+
# | **percentage** (float): [optional] The bid adjustment percentage value.
|
|
166
|
+
#
|
|
167
|
+
# Returns:
|
|
168
|
+
#
|
|
169
|
+
# ApiResponse
|
|
170
|
+
#
|
|
171
|
+
# """
|
|
172
|
+
#
|
|
173
|
+
# optional = {}
|
|
174
|
+
#
|
|
175
|
+
# if portfolio_id is not None:
|
|
176
|
+
# optional.update({'portfolioId': portfolio_id})
|
|
177
|
+
#
|
|
178
|
+
# if po_number is not None and account_manager is not None:
|
|
179
|
+
# optional.update({"tags": {'PONumber': po_number, 'accountManager': account_manager}})
|
|
180
|
+
#
|
|
181
|
+
# if end_date is not None:
|
|
182
|
+
# optional.update({'endDate': end_date})
|
|
183
|
+
#
|
|
184
|
+
# if premium_bid_adjustment is not None:
|
|
185
|
+
# optional.update({'premiumBidAdjustment': premium_bid_adjustment})
|
|
186
|
+
#
|
|
187
|
+
# if strategy is not None and predicate is not None and percentage is not None:
|
|
188
|
+
# if isinstance(predicate, str):
|
|
189
|
+
# optional.update(
|
|
190
|
+
# {
|
|
191
|
+
# 'bidding': {
|
|
192
|
+
# 'strategy': strategy,
|
|
193
|
+
# 'adjustments': [{'predicate': predicate, 'percentage': percentage}],
|
|
194
|
+
# }
|
|
195
|
+
# }
|
|
196
|
+
# )
|
|
197
|
+
#
|
|
198
|
+
# if isinstance(predicate, tuple) and len(predicate) == 2 and len(percentage) == 2:
|
|
199
|
+
# options = []
|
|
200
|
+
# for i in range(len(predicate)):
|
|
201
|
+
# option = {"predicate": predicate[i], "percentage": percentage[i]}
|
|
202
|
+
# options.append(option)
|
|
203
|
+
#
|
|
204
|
+
# bidding = {'strategy': strategy, 'adjustments': options}
|
|
205
|
+
#
|
|
206
|
+
# dictionary = {}
|
|
207
|
+
# dictionary["bidding"] = bidding
|
|
208
|
+
#
|
|
209
|
+
# optional.update(dictionary)
|
|
210
|
+
#
|
|
211
|
+
# required = {
|
|
212
|
+
# 'name': campaign_name,
|
|
213
|
+
# 'campaignType': 'sponsoredProducts',
|
|
214
|
+
# 'targetingType': targeting_type,
|
|
215
|
+
# 'state': campaign_status,
|
|
216
|
+
# 'dailyBudget': daily_budget,
|
|
217
|
+
# 'startDate': start_date,
|
|
218
|
+
# }
|
|
219
|
+
#
|
|
220
|
+
# if optional:
|
|
221
|
+
# required.update(optional)
|
|
222
|
+
#
|
|
223
|
+
# data_str = json.dumps([required])
|
|
224
|
+
# return self._request(kwargs.pop('path'), data=data_str, params=kwargs)
|
|
225
|
+
#
|
|
226
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
227
|
+
# @sp_endpoint('/v2/sp/campaigns', method='POST')
|
|
228
|
+
# @Utils.deprecated
|
|
229
|
+
# def create_campaigns(self, **kwargs) -> ApiResponse:
|
|
230
|
+
# r"""
|
|
231
|
+
# create_campaigns(body: (dict, str, list)) -> ApiResponse
|
|
232
|
+
#
|
|
233
|
+
# Creates one or more campaigns.
|
|
234
|
+
#
|
|
235
|
+
# body: | REQUIRED {'description': 'An array of campaigns.}'
|
|
236
|
+
#
|
|
237
|
+
# | '**portfolioId**': *number*, {'description': 'The identifier of an existing portfolio to which the campaign is associated'}
|
|
238
|
+
# | '**name**': *string*, {'description': 'A name for the campaign'}
|
|
239
|
+
# | '**tags**': *string*, {'description': 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers.'}
|
|
240
|
+
# | '**campaignType**': *string*, {'description': 'The advertising product managed by this campaign', 'Enum': '[ sponsoredProducts ]'}
|
|
241
|
+
# | '**targetingType**': *string*, {'description': 'The type of targeting for the campaign.', 'Enum': '[ manual, auto ]'}
|
|
242
|
+
# | '**state**': *string*, {'description': 'The current resource state.', 'Enum': '[ enabled, paused, archived ]'}
|
|
243
|
+
# | '**dailyBudget**': *number($float)*, {'description': 'A daily budget for the campaign.'}
|
|
244
|
+
# | '**startDate**': *string*, {'description': 'A starting date for the campaign to go live. The format of the date is YYYYMMDD.'}
|
|
245
|
+
# | '**endDate**': *string* nullable: true, {'description': 'An ending date for the campaign to stop running. The format of the date is YYYYMMDD.'}
|
|
246
|
+
# | '**premiumBidAdjustment**': *boolean*, {'description': 'If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.'}
|
|
247
|
+
# | '**bidding**': *Bidding*, {'strategy': 'string', 'Enum': '[ legacyForSales, autoForSales, manual ]', 'adjustments': '{...}'}
|
|
248
|
+
#
|
|
249
|
+
# Returns:
|
|
250
|
+
#
|
|
251
|
+
# ApiResponse
|
|
252
|
+
#
|
|
253
|
+
# """
|
|
254
|
+
# body = Utils.convert_body(kwargs.pop('body'))
|
|
255
|
+
# return self._request(kwargs.pop('path'), data=body, params=kwargs)
|
|
256
|
+
#
|
|
257
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
258
|
+
# @sp_endpoint('/v2/sp/campaigns', method='PUT')
|
|
259
|
+
# @Utils.deprecated
|
|
260
|
+
# def edit_campaigns(self, **kwargs) -> ApiResponse:
|
|
261
|
+
# r"""
|
|
262
|
+
# edit_campaigns(body: (dict, str, list)) -> ApiResponse
|
|
263
|
+
#
|
|
264
|
+
# Updates one or more campaigns.
|
|
265
|
+
#
|
|
266
|
+
# body: | REQUIRED {'description': 'An array of campaigns.}'
|
|
267
|
+
#
|
|
268
|
+
# | '**campaignId**': *number*, {'description': 'The identifier of an existing campaign to update.'}
|
|
269
|
+
# | '**portfolioId**': *number*, {'description': 'The identifier of an existing portfolio to which the campaign is associated'}
|
|
270
|
+
# | '**name**': *string*, {'description': 'The name for the campaign'}
|
|
271
|
+
# | '**tags**': *CampaignTags*, {'description': 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers.'}
|
|
272
|
+
# | '**state**': *string*, {'description': 'The current resource state.', 'Enum': '[ enabled, paused, archived ]'}
|
|
273
|
+
# | '**dailyBudget**': *number($float)*, {'description': 'The daily budget for the campaign.'}
|
|
274
|
+
# | '**startDate**': *string*, {'description': 'The starting date for the campaign to go live. The format of the date is YYYYMMDD.'}
|
|
275
|
+
# | '**endDate**': *string* nullable: true, {'description': 'The ending date for the campaign to stop running. The format of the date is YYYYMMDD.'}
|
|
276
|
+
# | '**premiumBidAdjustment**': *boolean*, {'description': 'If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.'}
|
|
277
|
+
# | '**bidding**': *Bidding*, {'strategy': 'string', 'Enum': '[ legacyForSales, autoForSales, manual ]', 'adjustments': '{...}'}
|
|
278
|
+
#
|
|
279
|
+
# Returns:
|
|
280
|
+
#
|
|
281
|
+
# ApiResponse
|
|
282
|
+
#
|
|
283
|
+
# """
|
|
284
|
+
# body = Utils.convert_body(kwargs.pop('body'))
|
|
285
|
+
# return self._request(kwargs.pop('path'), data=body, params=kwargs)
|
|
286
|
+
#
|
|
287
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
288
|
+
# @sp_endpoint('/v2/sp/campaigns', method='GET')
|
|
289
|
+
# @Utils.deprecated
|
|
290
|
+
# def list_campaigns(self, **kwargs) -> ApiResponse:
|
|
291
|
+
# r"""
|
|
292
|
+
# list_campaigns(**kwargs) -> ApiResponse
|
|
293
|
+
#
|
|
294
|
+
# Gets an array of campaigns.
|
|
295
|
+
#
|
|
296
|
+
# query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
|
|
297
|
+
#
|
|
298
|
+
# query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
|
|
299
|
+
#
|
|
300
|
+
# query **stateFilter**:*string* | Optional. The returned array is filtered to include only ad groups with state set to one of the values in the specified comma-delimited list. Available values : enabled, paused, archived, enabled, paused, enabled, archived, paused, archived, enabled, paused, archived Default value : enabled, paused, archived.
|
|
301
|
+
#
|
|
302
|
+
# query **name**:*string* | Optional. Restricts results to campaigns with the specified name.
|
|
303
|
+
#
|
|
304
|
+
# query **portfolioIdFilter**:*string* | Optional. A comma-delimited list of portfolio identifiers.
|
|
305
|
+
#
|
|
306
|
+
# query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
|
|
307
|
+
#
|
|
308
|
+
# Returns:
|
|
309
|
+
#
|
|
310
|
+
# ApiResponse
|
|
311
|
+
#
|
|
312
|
+
# """
|
|
313
|
+
# return self._request(kwargs.pop('path'), params=kwargs)
|
|
314
|
+
#
|
|
315
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
316
|
+
# @sp_endpoint('/v2/sp/campaigns/{}', method='GET')
|
|
317
|
+
# @Utils.deprecated
|
|
318
|
+
# def get_campaign(self, campaignId, **kwargs) -> ApiResponse:
|
|
319
|
+
# r"""
|
|
320
|
+
#
|
|
321
|
+
# get_campaign(campaignId: int) -> ApiResponse
|
|
322
|
+
#
|
|
323
|
+
# Gets a campaign specified by identifier.
|
|
324
|
+
#
|
|
325
|
+
# path **campaignId**:*number* | Required. The identifier of an existing campaign.
|
|
326
|
+
#
|
|
327
|
+
# Returns:
|
|
328
|
+
#
|
|
329
|
+
# ApiResponse
|
|
330
|
+
#
|
|
331
|
+
# """
|
|
332
|
+
# return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
|
|
333
|
+
#
|
|
334
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
335
|
+
# @sp_endpoint('/v2/sp/campaigns/{}', method='DELETE')
|
|
336
|
+
# @Utils.deprecated
|
|
337
|
+
# def delete_campaign(self, campaignId, **kwargs) -> ApiResponse:
|
|
338
|
+
# r"""
|
|
339
|
+
#
|
|
340
|
+
# delete_campaign(campaignId: int) -> ApiResponse
|
|
341
|
+
#
|
|
342
|
+
# Sets the campaign status to archived. Archived entities cannot be made active again. See developer notes for more information.
|
|
343
|
+
#
|
|
344
|
+
# path **campaignId**:*number* | Required. The identifier of an existing campaign.
|
|
345
|
+
#
|
|
346
|
+
# Returns:
|
|
347
|
+
#
|
|
348
|
+
# ApiResponse
|
|
349
|
+
#
|
|
350
|
+
# """
|
|
351
|
+
# return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
|
|
352
|
+
#
|
|
353
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
354
|
+
# @sp_endpoint('/v2/sp/campaigns/extended', method='GET')
|
|
355
|
+
# @Utils.deprecated
|
|
356
|
+
# def list_campaigns_extended(self, **kwargs) -> ApiResponse:
|
|
357
|
+
# r"""
|
|
358
|
+
# list_campaigns_extended(**kwargs) -> ApiResponse
|
|
359
|
+
#
|
|
360
|
+
# Gets an array of campaigns with extended data fields.
|
|
361
|
+
#
|
|
362
|
+
# query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
|
|
363
|
+
#
|
|
364
|
+
# query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
|
|
365
|
+
#
|
|
366
|
+
# query **stateFilter**:*string* | Optional. The returned array is filtered to include only ad groups with state set to one of the values in the specified comma-delimited list. Available values : enabled, paused, archived, enabled, paused, enabled, archived, paused, archived, enabled, paused, archived Default value : enabled, paused, archived.
|
|
367
|
+
#
|
|
368
|
+
# query **name**:*string* | Optional. Restricts results to campaigns with the specified name.
|
|
369
|
+
#
|
|
370
|
+
# query **portfolioIdFilter**:*string* | Optional. A comma-delimited list of portfolio identifiers.
|
|
371
|
+
#
|
|
372
|
+
# query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
|
|
373
|
+
#
|
|
374
|
+
# Returns:
|
|
375
|
+
#
|
|
376
|
+
# ApiResponse
|
|
377
|
+
#
|
|
378
|
+
# """
|
|
379
|
+
# return self._request(kwargs.pop('path'), params=kwargs)
|
|
380
|
+
#
|
|
381
|
+
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
382
|
+
# @sp_endpoint('/v2/sp/campaigns/extended/{}', method='GET')
|
|
383
|
+
# @Utils.deprecated
|
|
384
|
+
# def get_campaign_extended(self, campaignId, **kwargs) -> ApiResponse:
|
|
385
|
+
# r"""
|
|
386
|
+
# get_campaign_extended(campaignId: int) -> ApiResponse
|
|
387
|
+
#
|
|
388
|
+
# Gets an array of campaigns with extended data fields.
|
|
389
|
+
#
|
|
390
|
+
# path **campaignId**:*number* | Required. The identifier of an existing campaign.
|
|
391
|
+
#
|
|
392
|
+
# Returns:
|
|
393
|
+
#
|
|
394
|
+
# ApiResponse
|
|
395
|
+
#
|
|
396
|
+
# """
|
|
397
|
+
# return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
|
|
398
|
+
#
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.9"
|
{python_amazon_ad_api-0.9.7 → python_amazon_ad_api-0.9.9}/python_amazon_ad_api.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-amazon-ad-api
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.9
|
|
4
4
|
Summary: Python wrapper for the Amazon Advertising API
|
|
5
5
|
Home-page: https://github.com/denisneuf/python-amazon-ad-api
|
|
6
6
|
Author: Daniel Alvaro
|
|
@@ -299,6 +299,34 @@ There is a new version 3 Portfolios API, please check the [migration guide](http
|
|
|
299
299
|
* [Get test account information](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_test_account.html#ad_api.api.AdvertisingTestAccount.AdvertisingTestAccount.get_test_account)
|
|
300
300
|
|
|
301
301
|
|
|
302
|
+
### Sponsored Products v1 (new)
|
|
303
|
+
|
|
304
|
+
New unified endpoint generation. Campaigns are queried with a single `POST /adsApi/v1/query/campaigns` resource instead of the versioned v2/v3 endpoints.
|
|
305
|
+
|
|
306
|
+
| Method | Endpoint | Body |
|
|
307
|
+
|---|---|---|
|
|
308
|
+
| `query_campaigns` | `POST /adsApi/v1/query/campaigns` | filters + `maxResults`/`nextToken` |
|
|
309
|
+
| `create_campaigns` | `POST /adsApi/v1/create/campaigns` | `campaigns[]` (`adProduct`, `name`, `state` required) |
|
|
310
|
+
| `update_campaigns` | `POST /adsApi/v1/update/campaigns` | `campaigns[]` (`campaignId` required) |
|
|
311
|
+
| `delete_campaigns` | `POST /adsApi/v1/delete/campaigns` | `campaignIds[]` |
|
|
312
|
+
|
|
313
|
+
All four return a **207 MultiStatus** response (except `query_campaigns`, which returns 200), so check the payload for per-entity errors.
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
from ad_api.api import sponsored_products
|
|
317
|
+
|
|
318
|
+
result = sponsored_products.Campaigns(credentials=credentials, debug=True).query_campaigns(
|
|
319
|
+
body={
|
|
320
|
+
"adProductFilter": {"include": ["SPONSORED_PRODUCTS"]},
|
|
321
|
+
"stateFilter": {"include": ["ENABLED"]},
|
|
322
|
+
"maxResults": 100,
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
campaigns = result.payload.get("campaigns")
|
|
327
|
+
next_token = result.payload.get("nextToken")
|
|
328
|
+
```
|
|
329
|
+
|
|
302
330
|
### [Modules Available Sponsored Products 2.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sp_v2.html)
|
|
303
331
|
|
|
304
332
|
Warning: [PLANNED DEPRECATION 6/30/2023]
|
|
@@ -307,6 +335,8 @@ There is a new version 3 of Sponsored Product API, please check the [migration g
|
|
|
307
335
|
|
|
308
336
|
### [Modules Available Sponsored Products 3.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sp_v3.html)
|
|
309
337
|
|
|
338
|
+
Warning: `list_campaigns` is deprecated. Use the v1 `query_campaigns` method instead.
|
|
339
|
+
|
|
310
340
|
|
|
311
341
|
* [ThemeBased Bid Recommendation](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/bid_recommendations_v3.html)
|
|
312
342
|
* [Keyword Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/ranked_keywords_recommendations.html)
|
|
@@ -375,7 +405,9 @@ There is a new version 3 of Sponsored Product API, please check the [migration g
|
|
|
375
405
|
|
|
376
406
|
* [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/dsp/reports.html)
|
|
377
407
|
|
|
378
|
-
### Simple Example Usage Campaigns with Credentials
|
|
408
|
+
### Simple Example Usage Campaigns with Credentials (v3, legacy)
|
|
409
|
+
|
|
410
|
+
Warning: this example uses `CampaignsV3.list_campaigns`, which is deprecated. See the v1 `query_campaigns` example above.
|
|
379
411
|
|
|
380
412
|
```python
|
|
381
413
|
import logging
|
|
@@ -443,4 +475,4 @@ We are not affiliated with Amazon but they used our api :)
|
|
|
443
475
|
|
|
444
476
|
|
|
445
477
|
---
|
|
446
|
-
*Last release: v0.
|
|
478
|
+
*Last release: v0.9.7*
|