python-amazon-ad-api 1.8.2__tar.gz → 2.0.1__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.
Files changed (147) hide show
  1. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/PKG-INFO +17 -2
  2. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/README.md +16 -1
  3. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/__init__.py +0 -2
  4. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/billing.py +46 -10
  5. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/eligibility.py +3 -7
  6. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/reports.py +25 -1
  7. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/budget_rules.py +2 -4
  8. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/campaigns_v4.py +1 -2
  9. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/migration.py +1 -2
  10. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/optimization_rules.py +1 -2
  11. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/reports.py +18 -0
  12. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/reports.py +18 -0
  13. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/__init__.py +6 -0
  14. python_amazon_ad_api-2.0.1/ad_api/api/sp/budget_initial_recommendation.py +47 -0
  15. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/budget_rules.py +41 -0
  16. python_amazon_ad_api-2.0.1/ad_api/api/sp/budget_rules_recommendations.py +44 -0
  17. python_amazon_ad_api-2.0.1/ad_api/api/sp/campaign_consolidated_recommendations.py +49 -0
  18. python_amazon_ad_api-2.0.1/ad_api/api/sp/global_recommendations.py +97 -0
  19. python_amazon_ad_api-2.0.1/ad_api/api/sp/keyword_groups_recommendations.py +34 -0
  20. python_amazon_ad_api-2.0.1/ad_api/api/sp/target_promotion_groups.py +141 -0
  21. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/ad_groups.py +5 -7
  22. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/advertiser_accounts.py +3 -3
  23. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/brand_store_edition_publish_versions.py +1 -2
  24. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/brand_store_pages.py +1 -1
  25. python_amazon_ad_api-2.0.1/ad_api/version.py +1 -0
  26. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/python_amazon_ad_api.egg-info/PKG-INFO +17 -2
  27. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/python_amazon_ad_api.egg-info/SOURCES.txt +3 -1
  28. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/setup.cfg +1 -1
  29. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/setup.py +1 -1
  30. python_amazon_ad_api-1.8.2/ad_api/api/invoices.py +0 -44
  31. python_amazon_ad_api-1.8.2/ad_api/api/sp/budget_initial_recommendation.py +0 -10
  32. python_amazon_ad_api-1.8.2/ad_api/api/sp/budget_rules_recommendations.py +0 -19
  33. python_amazon_ad_api-1.8.2/ad_api/api/sp/campaign_consolidated_recommendations.py +0 -19
  34. python_amazon_ad_api-1.8.2/ad_api/version.py +0 -1
  35. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/LICENSE +0 -0
  36. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/__init__.py +0 -0
  37. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/account.py +0 -0
  38. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/account_budgets.py +0 -0
  39. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/advertising_test_account.py +0 -0
  40. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/attribution.py +0 -0
  41. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/audiences.py +0 -0
  42. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/brand_metrics.py +0 -0
  43. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/creative_assets.py +0 -0
  44. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/exports.py +0 -0
  45. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/history.py +0 -0
  46. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/insights.py +0 -0
  47. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/localization.py +0 -0
  48. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/manager_accounts.py +0 -0
  49. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/metadata.py +0 -0
  50. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/portfolios.py +0 -0
  51. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/portfolios_v3.py +0 -0
  52. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/profiles.py +0 -0
  53. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/recommendations.py +0 -0
  54. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/__init__.py +0 -0
  55. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/ad_creatives_v4.py +0 -0
  56. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/ad_groups.py +0 -0
  57. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/ad_groups_v4.py +0 -0
  58. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/ads_v4.py +0 -0
  59. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/benchmarks.py +0 -0
  60. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/bid_recommendations.py +0 -0
  61. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/brands.py +0 -0
  62. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/campaigns.py +0 -0
  63. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/forecast.py +0 -0
  64. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/keywords.py +0 -0
  65. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/keywords_recommendations.py +0 -0
  66. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/landing_page_asins.py +0 -0
  67. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/media.py +0 -0
  68. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/negative_keywords.py +0 -0
  69. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/negative_product_targeting.py +0 -0
  70. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/product_targeting.py +0 -0
  71. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/recommendations.py +0 -0
  72. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/stores.py +0 -0
  73. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/targeting_categories.py +0 -0
  74. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/targeting_recommendations.py +0 -0
  75. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sb/themes.py +0 -0
  76. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/__init__.py +0 -0
  77. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/ad_groups.py +0 -0
  78. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/bid_recommendations.py +0 -0
  79. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/brand_safety.py +0 -0
  80. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/budget_rules.py +0 -0
  81. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/campaigns.py +0 -0
  82. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/campaigns_budget_usage.py +0 -0
  83. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/creatives.py +0 -0
  84. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/forecast.py +0 -0
  85. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/negative_product_targeting.py +0 -0
  86. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/product_ads.py +0 -0
  87. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/product_targeting.py +0 -0
  88. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/recommendations.py +0 -0
  89. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/snapshots.py +0 -0
  90. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sd/targeting_recommendations.py +0 -0
  91. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/ad_groups_v3.py +0 -0
  92. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/bid_recommendations_v3.py +0 -0
  93. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/budget_recommendations.py +0 -0
  94. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/campaign_negative_keywords_v3.py +0 -0
  95. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/campaign_negative_targets.py +0 -0
  96. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/campaigns_budget_usage.py +0 -0
  97. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/campaigns_v3.py +0 -0
  98. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/campaings_optimization.py +0 -0
  99. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/keywords_v3.py +0 -0
  100. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/negative_keywords_v3.py +0 -0
  101. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/negative_product_targeting_v3.py +0 -0
  102. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/product_ads_v3.py +0 -0
  103. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/product_recommendations.py +0 -0
  104. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/product_targeting_v3.py +0 -0
  105. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/ranked_keywords_recommendations.py +0 -0
  106. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/sp/schedule_based_bid_optimization.py +0 -0
  107. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/stores.py +0 -0
  108. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/stream.py +0 -0
  109. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/__init__.py +0 -0
  110. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/ad_associations.py +0 -0
  111. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/ad_extensions.py +0 -0
  112. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/ads.py +0 -0
  113. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/brand_store_editions.py +0 -0
  114. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/brand_stores.py +0 -0
  115. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/campaigns.py +0 -0
  116. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/geo_locations.py +0 -0
  117. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/label_object_associations.py +0 -0
  118. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/labels.py +0 -0
  119. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/location_indexes.py +0 -0
  120. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/manager_accounts.py +0 -0
  121. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/portfolios.py +0 -0
  122. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/recommendation_types.py +0 -0
  123. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/recommendations.py +0 -0
  124. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/reports.py +0 -0
  125. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/selling_accounts.py +0 -0
  126. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/v1/targets.py +0 -0
  127. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/api/validation_configurations.py +0 -0
  128. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/auth/__init__.py +0 -0
  129. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/auth/access_token_client.py +0 -0
  130. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/auth/access_token_response.py +0 -0
  131. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/auth/credentials.py +0 -0
  132. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/auth/exceptions.py +0 -0
  133. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/__init__.py +0 -0
  134. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/api_response.py +0 -0
  135. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/client.py +0 -0
  136. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/config.py +0 -0
  137. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/credential_provider.py +0 -0
  138. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/exceptions.py +0 -0
  139. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/helpers.py +0 -0
  140. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/marketplaces.py +0 -0
  141. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/base/utils.py +0 -0
  142. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/shared/__init__.py +0 -0
  143. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/ad_api/shared/base_client.py +0 -0
  144. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/pyproject.toml +0 -0
  145. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/python_amazon_ad_api.egg-info/dependency_links.txt +0 -0
  146. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/python_amazon_ad_api.egg-info/requires.txt +0 -0
  147. {python_amazon_ad_api-1.8.2 → python_amazon_ad_api-2.0.1}/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: 1.8.2
3
+ Version: 2.0.1
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
@@ -245,6 +245,22 @@ except AdvertisingApiException as error:
245
245
  ```
246
246
 
247
247
 
248
+ ### Migrating from 1.x
249
+
250
+ `ad_api.api.Invoices` no longer exists. Amazon serves `/invoices` and
251
+ `/invoices/{invoiceId}` from the same contract as the rest of billing, so both
252
+ methods moved to `Billing`:
253
+
254
+ ```python
255
+ # before
256
+ from ad_api.api import Invoices
257
+ Invoices(account=store).list_invoices()
258
+
259
+ # now
260
+ from ad_api.api import Billing
261
+ Billing(account=store).list_invoices()
262
+ ```
263
+
248
264
  ### [Modules Available Common Resources](https://python-amazon-ad-api.readthedocs.io/en/latest/api.html)
249
265
 
250
266
  | Module | Vendor contract | Vendor docs |
@@ -252,7 +268,6 @@ except AdvertisingApiException as error:
252
268
  | [Profiles](https://python-amazon-ad-api.readthedocs.io/en/latest/api/profiles.html) | [contract](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/profiles/3-0/openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/2/profiles) |
253
269
  | [Manager Accounts](https://python-amazon-ad-api.readthedocs.io/en/latest/api/manager_accounts.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/ManagerAccount_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/1-0/managerAccount) |
254
270
  | [PortfoliosV3](https://python-amazon-ad-api.readthedocs.io/en/latest/api/portfoliosV3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Portfolios_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/portfolios) |
255
- | [Invoices](https://python-amazon-ad-api.readthedocs.io/en/latest/api/invoices.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingBilling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/billing) |
256
271
  | [Billing](https://python-amazon-ad-api.readthedocs.io/en/latest/api/billing.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingBilling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/billing) |
257
272
  | [Account Budgets](https://python-amazon-ad-api.readthedocs.io/en/latest/api/account_budgets.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Advertisers_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/account-budgets/) |
258
273
  | [Audiences](https://python-amazon-ad-api.readthedocs.io/en/latest/api/audiences.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Audiences_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/audiences/) |
@@ -217,6 +217,22 @@ except AdvertisingApiException as error:
217
217
  ```
218
218
 
219
219
 
220
+ ### Migrating from 1.x
221
+
222
+ `ad_api.api.Invoices` no longer exists. Amazon serves `/invoices` and
223
+ `/invoices/{invoiceId}` from the same contract as the rest of billing, so both
224
+ methods moved to `Billing`:
225
+
226
+ ```python
227
+ # before
228
+ from ad_api.api import Invoices
229
+ Invoices(account=store).list_invoices()
230
+
231
+ # now
232
+ from ad_api.api import Billing
233
+ Billing(account=store).list_invoices()
234
+ ```
235
+
220
236
  ### [Modules Available Common Resources](https://python-amazon-ad-api.readthedocs.io/en/latest/api.html)
221
237
 
222
238
  | Module | Vendor contract | Vendor docs |
@@ -224,7 +240,6 @@ except AdvertisingApiException as error:
224
240
  | [Profiles](https://python-amazon-ad-api.readthedocs.io/en/latest/api/profiles.html) | [contract](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/profiles/3-0/openapi.yaml) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/2/profiles) |
225
241
  | [Manager Accounts](https://python-amazon-ad-api.readthedocs.io/en/latest/api/manager_accounts.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/ManagerAccount_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/1-0/managerAccount) |
226
242
  | [PortfoliosV3](https://python-amazon-ad-api.readthedocs.io/en/latest/api/portfoliosV3.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Portfolios_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/reference/portfolios) |
227
- | [Invoices](https://python-amazon-ad-api.readthedocs.io/en/latest/api/invoices.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingBilling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/billing) |
228
243
  | [Billing](https://python-amazon-ad-api.readthedocs.io/en/latest/api/billing.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/AdvertisingBilling_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/billing) |
229
244
  | [Account Budgets](https://python-amazon-ad-api.readthedocs.io/en/latest/api/account_budgets.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Advertisers_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/account-budgets/) |
230
245
  | [Audiences](https://python-amazon-ad-api.readthedocs.io/en/latest/api/audiences.html) | [contract](https://d1y2lf8k3vrkfu.cloudfront.net/openapi/en-us/dest/Audiences_prod_3p.json) | [docs](https://advertising.amazon.com/API/docs/en-us/audiences/) |
@@ -1,7 +1,6 @@
1
1
  from .account import Account
2
2
  from .profiles import Profiles
3
3
  from .manager_accounts import ManagerAccounts
4
- from .invoices import Invoices
5
4
  from .billing import Billing
6
5
  from .account_budgets import AccountBudgets
7
6
  from .eligibility import Eligibility
@@ -38,7 +37,6 @@ __all__ = [
38
37
  "sponsored_display",
39
38
  "Profiles",
40
39
  "ManagerAccounts",
41
- "Invoices",
42
40
  "Billing",
43
41
  "AccountBudgets",
44
42
  "Eligibility",
@@ -64,8 +64,7 @@ class Billing(Client):
64
64
  Query
65
65
 
66
66
  - ``criteriaType`` (string): required. ``PAY_NOW`` or ``AUTO_PAY``. The
67
- service answers ``400 Value null at 'criteriaType' failed to satisfy
68
- constraint`` when it is missing. It does not go in the body; this route
67
+ service answers ``400 Value null at 'criteriaType' failed to satisfy constraint`` when it is missing. It does not go in the body; this route
69
68
  takes no body.
70
69
 
71
70
  Returns
@@ -136,8 +135,7 @@ class Billing(Client):
136
135
  Query
137
136
 
138
137
  - ``agreementType`` (string): required. ``AUTO_PAY`` or ``PAY_NOW``. The
139
- service answers ``400 Value null at 'agreementType' failed to satisfy
140
- constraint`` when it is missing. It does not go in the body; this route
138
+ service answers ``400 Value null at 'agreementType' failed to satisfy constraint`` when it is missing. It does not go in the body; this route
141
139
  takes no body.
142
140
 
143
141
  Returns
@@ -219,8 +217,7 @@ class Billing(Client):
219
217
  - ``sort`` (object): ``attribute`` and ``direction``. The only
220
218
  attributes the service accepts are ``invoiceIssuedDate`` and
221
219
  ``invoiceDueDate``; anything else answers
222
- ``400 Invalid input because of error(s): [sort:attribute field is
223
- invalid]``. Those are the names the answer uses, not the filter names:
220
+ ``400 Invalid input because of error(s): [sort:attribute field is invalid]``. Those are the names the answer uses, not the filter names:
224
221
  ``invoiceDate``, ``issuedDate``, ``dueDate``, ``amountDue`` and
225
222
  ``status`` are all refused.
226
223
  - ``maxResults`` (integer): page size.
@@ -268,8 +265,7 @@ class Billing(Client):
268
265
  .. warning::
269
266
 
270
267
  The service refuses marketplace accounts. Called from a regional
271
- seller account it answers ``400 The API doesnot support marketplace
272
- accounts``. It wants a Global, Manager or Sponsored Ads account.
268
+ seller account it answers ``400 The API doesnot support marketplace accounts``. It wants a Global, Manager or Sponsored Ads account.
273
269
 
274
270
  Returns
275
271
  ApiResponse with the profiles and the token for the next page.
@@ -304,8 +300,7 @@ class Billing(Client):
304
300
  .. warning::
305
301
 
306
302
  Same account restriction as ``list_billing_profiles``, and the
307
- message names what it wants: ``only Global, Manager and Sponsored
308
- Ads marketplace accounts are supported``.
303
+ message names what it wants: ``only Global, Manager and Sponsored Ads marketplace accounts are supported``.
309
304
 
310
305
  Returns
311
306
  ApiResponse with one entry per country and profile pairing.
@@ -549,3 +544,44 @@ class Billing(Client):
549
544
  }
550
545
  body = Utils.convert_body(kwargs.pop('body'), False)
551
546
  return self._request(kwargs.pop('path'), data=body, params=kwargs, headers=headers)
547
+
548
+ @sp_endpoint('/invoices', method='GET')
549
+ def list_invoices(self, **kwargs) -> ApiResponse:
550
+ r"""
551
+ Get invoices for advertiser. Requires one of these permissions: ["nemo_transactions_view","nemo_transactions_edit"]
552
+
553
+ query **invoiceStatuses**:*string* | Optional. Available values : ISSUED, PAID_IN_PART, PAID_IN_FULL, WRITTEN_OFF. (Not documented: ACCUMULATING)
554
+
555
+ query **count**:*string* | Optional. Number of records to include in the paged response. Defaults to 100. Cannot be combined with the cursor parameter.
556
+
557
+ query **cursor**:*string* | Optional. A cursor representing how far into a result set this query should begin. In the absence of a cursor the request will default to start index of 0 and page size of 100.
558
+
559
+
560
+ Returns:
561
+
562
+ ApiResponse whose payload carries a second layer::
563
+
564
+ {"status": "success",
565
+ "payload": {"nextCursor": "...", "invoiceSummaries": [...]}}
566
+
567
+ The invoices sit at ``res.payload["payload"]["invoiceSummaries"]``.
568
+ Reading ``res.payload["invoiceSummaries"]`` gives ``None``, because
569
+ that key belongs to the inner object.
570
+
571
+ """
572
+ return self._request(kwargs.pop('path'), params=kwargs)
573
+
574
+ @sp_endpoint('/invoices/{}', method='GET')
575
+ def get_invoice(self, invoiceId, **kwargs) -> ApiResponse:
576
+ r"""
577
+ Get invoice data by invoice ID. Requires one of these permissions: ["nemo_transactions_view","nemo_transactions_edit"]
578
+
579
+ path **invoiceId**:*string* | required. ID of invoice to fetch
580
+
581
+ Returns:
582
+
583
+ ApiResponse with the same two layers as ``list_invoices``: the
584
+ invoice data sits under ``res.payload["payload"]``.
585
+
586
+ """
587
+ return self._request(fill_query_params(kwargs.pop('path'), invoiceId), params=kwargs)
@@ -74,13 +74,9 @@ class Eligibility(Client):
74
74
  product: Sponsored Products, Sponsored Brands, Sponsored Display,
75
75
  Stores, DirectToConsumer, Amazon Attribution and the rest.
76
76
 
77
- Two media types are declared:
78
-
79
- application/json the default shape, with skipChecks
80
- application/vnd.programeligibility.v2+json
81
- v2, with maxResults and nextToken
82
-
83
- Pass media_type='v2' for the paginated one.
77
+ Two media types are declared: application/json is the default shape, with
78
+ skipChecks, and application/vnd.programeligibility.v2+json is the v2 one,
79
+ with maxResults and nextToken. Pass media_type='v2' for the paginated one.
84
80
  """
85
81
 
86
82
  media_type = kwargs.pop('media_type', None)
@@ -41,7 +41,31 @@ class Reports(Client):
41
41
  def get_report(self, reportId, **kwargs) -> ApiResponse:
42
42
  r"""
43
43
  Gets a generation status of a report by id. Uses the reportId value from the response of previously requested report via POST /reporting/reports operation. When status is set to COMPLETED, the report will be available to be downloaded at url.
44
- Report generation can take as long as 3 hours. Repeated calls to check report status may generate a 429 response, indicating that your requests have been throttled. To retrieve reports programmatically, your application logic should institute a delay between requests.
44
+ Report generation can take as long as 3 hours.
45
+
46
+ Throttling
47
+ Repeated calls to check report status may generate a 429 response.
48
+ Amazon publishes no numeric rate limit: the API answers 429 with a
49
+ Retry-After header in seconds, and the limit itself is dynamic and
50
+ follows the overall system load. For the reporting API it follows the
51
+ size of the per-region report queue, so the same polling rate can
52
+ pass at one hour and be rejected at a regional peak.
53
+
54
+ When the Retry-After header is present, wait at least that many
55
+ seconds. When it is missing, fall back to exponential backoff with a
56
+ ceiling and some jitter rather than a fixed delay: Amazon recommends
57
+ exponential backoff on a run of 429s, with longer periods for report
58
+ generation because the dynamic limits move slowly.
59
+
60
+ A 425 is not throttling. Sending the same create request while the
61
+ first is still running answers 425 "The Request is a duplicate of :
62
+ <reportId>". Take the id out of the message and poll it; resending
63
+ keeps answering 425 even though the report already exists. This is
64
+ not part of Amazon's rate limiting documentation, it is what the API
65
+ returns in practice.
66
+
67
+ Source: rate limiting page of the Amazon Ads API documentation,
68
+ https://advertising.amazon.com/API/docs/en-us/reference/concepts/rate-limiting
45
69
 
46
70
  Keyword Args
47
71
  | path **reportId** (number): The report identifier. [required]
@@ -11,8 +11,7 @@ class BudgetRules(Client):
11
11
 
12
12
  .. note::
13
13
  ``budget_recommendations`` only answers with the versioned media type.
14
- Sending ``application/json`` makes the router answer ``404 Could not find
15
- resource``, as if the route did not exist. Amazon routes on media type.
14
+ Sending ``application/json`` makes the router answer ``404 Could not find resource``, as if the route did not exist. Amazon routes on media type.
16
15
 
17
16
  .. note::
18
17
  An unknown ``budgetRuleId`` answers ``400 InvalidParameterValue`` with
@@ -209,8 +208,7 @@ class BudgetRules(Client):
209
208
 
210
209
  .. warning::
211
210
  This route only answers with its versioned media type. With
212
- ``application/json`` the service answers ``404 Could not find
213
- resource``, which reads like a missing route but is only the wrong
211
+ ``application/json`` the service answers ``404 Could not find resource``, which reads like a missing route but is only the wrong
214
212
  media type.
215
213
  """
216
214
  return self._request(kwargs.pop('path'),
@@ -93,8 +93,7 @@ class CampaignsV4(Client):
93
93
 
94
94
  .. note::
95
95
  This route takes ``application/vnd.sbinsights.v4+json``, not the
96
- campaigns media type. With ``application/json`` it answers ``404
97
- Could not find resource``, so the versioned type is what routes it.
96
+ campaigns media type. With ``application/json`` it answers ``404 Could not find resource``, so the versioned type is what routes it.
98
97
 
99
98
  .. note::
100
99
  An empty body answers ``400`` naming ``adGroups``, which is the only
@@ -22,8 +22,7 @@ class Migration(Client):
22
22
  type; a wrong one reads exactly like a missing route.
23
23
 
24
24
  .. note::
25
- ``migration_job_status`` and ``migration_job_results`` answer ``500
26
- INTERNAL_ERROR`` for a job identifier that does not exist, instead of a
25
+ ``migration_job_status`` and ``migration_job_results`` answer ``500 INTERNAL_ERROR`` for a job identifier that does not exist, instead of a
27
26
  400 or a 404. The routes are live; the service trips over an unknown id.
28
27
  """
29
28
 
@@ -10,8 +10,7 @@ class OptimizationRules(Client):
10
10
  service routes on it:
11
11
 
12
12
  .. warning::
13
- With ``application/json`` the router answers ``404 Could not find
14
- resource`` on every route here, which reads like a missing route but is
13
+ With ``application/json`` the router answers ``404 Could not find resource`` on every route here, which reads like a missing route but is
15
14
  only the wrong media type. Verified on ``list`` and ``recommendations``.
16
15
 
17
16
  The two read routes were probed against a live account; the four write routes
@@ -47,6 +47,24 @@ class Reports(Client):
47
47
  Request body
48
48
  | **creativeType** (string): [optional] Set to `video` to retrieve a Sponsored Brands video report.
49
49
 
50
+ Throttling
51
+ Polling this route can answer 429. Amazon publishes no numeric rate
52
+ limit: the limit is dynamic and follows the overall system load, and
53
+ for the reporting API it follows the size of the per-region report
54
+ queue, so the same polling rate can pass at one hour and be rejected
55
+ at a regional peak.
56
+
57
+ A 429 carries a Retry-After header in seconds. When it is missing,
58
+ fall back to exponential backoff with a ceiling and some jitter
59
+ rather than a fixed delay.
60
+
61
+ A 425 on the create call is not throttling: "The Request is a
62
+ duplicate of : <reportId>" means the report already exists. Take
63
+ that id and poll it instead of creating another.
64
+
65
+ Source: rate limiting page of the Amazon Ads API documentation,
66
+ https://advertising.amazon.com/API/docs/en-us/reference/concepts/rate-limiting
67
+
50
68
  Returns:
51
69
  ApiResponse
52
70
  """
@@ -47,6 +47,24 @@ class Reports(Client):
47
47
  Keyword Args
48
48
  | path **reportId** (string): [required] The report identifier.
49
49
 
50
+ Throttling
51
+ Polling this route can answer 429. Amazon publishes no numeric rate
52
+ limit: the limit is dynamic and follows the overall system load, and
53
+ for the reporting API it follows the size of the per-region report
54
+ queue, so the same polling rate can pass at one hour and be rejected
55
+ at a regional peak.
56
+
57
+ A 429 carries a Retry-After header in seconds. When it is missing,
58
+ fall back to exponential backoff with a ceiling and some jitter
59
+ rather than a fixed delay.
60
+
61
+ A 425 on the create call is not throttling: "The Request is a
62
+ duplicate of : <reportId>" means the report already exists. Take
63
+ that id and poll it instead of creating another.
64
+
65
+ Source: rate limiting page of the Amazon Ads API documentation,
66
+ https://advertising.amazon.com/API/docs/en-us/reference/concepts/rate-limiting
67
+
50
68
  Returns:
51
69
  ApiResponse
52
70
  """
@@ -18,6 +18,9 @@ from .budget_rules_recommendations import BudgetRulesRecommendations
18
18
  from .product_recommendations import ProductRecommendations
19
19
  from .campaigns_budget_usage import CampaignsBudgetUsage
20
20
  from .schedule_based_bid_optimization import ScheduleBasedBidOptimizationRules
21
+ from .target_promotion_groups import TargetPromotionGroups
22
+ from .keyword_groups_recommendations import KeywordGroupsRecommendations
23
+ from .global_recommendations import GlobalRecommendations
21
24
 
22
25
  __all__ = [
23
26
  "CampaignsV3",
@@ -40,4 +43,7 @@ __all__ = [
40
43
  "ProductRecommendations",
41
44
  "CampaignsBudgetUsage",
42
45
  "ScheduleBasedBidOptimizationRules",
46
+ "TargetPromotionGroups",
47
+ "KeywordGroupsRecommendations",
48
+ "GlobalRecommendations",
43
49
  ]
@@ -0,0 +1,47 @@
1
+ from ad_api.base import Client, sp_endpoint, ApiResponse, Utils
2
+
3
+
4
+ class InitialBudgetRecommendation(Client):
5
+ @sp_endpoint('/sp/campaigns/initialBudgetRecommendation', method='POST')
6
+ def initial_campaign_budget_recommendation(self, **kwargs) -> ApiResponse:
7
+ r"""
8
+ Creates a daily budget recommendation, with benchmark metrics, while
9
+ creating a new campaign. Nothing is created and nothing is charged.
10
+
11
+ The path carries a capital B: initialBudgetRecommendation. Spelled in
12
+ lower case the gateway does not recognise the route and answers 403
13
+ IncompleteSignatureException, so the case matters here.
14
+
15
+ Request Body [Required]
16
+ | **adGroups** (array): exactly one ad group.
17
+ | **asins** (array): [required] 1 to 50 ASINs.
18
+ | **targetingExpressions** (array): [required] 1 to 100.
19
+ | **type** (string): [required] CLOSE_MATCH, COMPLEMENTS,
20
+ | KEYWORD_BROAD_MATCH, KEYWORD_EXACT_MATCH, KEYWORD_PHRASE_MATCH,
21
+ | LOOSE_MATCH or SUBSTITUTES.
22
+ | **value** (string): [required] must be empty when targetingType
23
+ | is auto. The service rejects a non-empty value with
24
+ | "Targeting expression's value should be empty for auto".
25
+ | **bid** (number): [required] the service rejects a null bid with
26
+ | "TargetingExpression bid cannot be null", even though the
27
+ | contract does not declare it.
28
+ | **bidding** (object): [required]
29
+ | **strategy** (string): [required] AUTO_FOR_SALES,
30
+ | LEGACY_FOR_SALES or MANUAL.
31
+ | **adjustments** (array): up to 2 placement adjustments.
32
+ | **targetingType** (string): [required] auto or manual.
33
+ | **startDate** (string): YYYYMMDD.
34
+ | **endDate** (string): YYYYMMDD.
35
+
36
+ Returns:
37
+ ApiResponse
38
+ dailyBudget, recommendationId, benchmark and specialEvents.
39
+ A dailyBudget of -1 means there is not enough information to
40
+ produce a recommendation.
41
+
42
+ """
43
+
44
+ json_version = 'application/vnd.spinitialbudgetrecommendation.v3.4+json'
45
+
46
+ headers = {"Accept": json_version, "Content-Type": json_version}
47
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
@@ -244,3 +244,44 @@ class BudgetRules(Client):
244
244
 
245
245
  """
246
246
  return self._request(fill_query_params(kwargs.pop('path'), budgetRuleId), params=kwargs)
247
+
248
+ @sp_endpoint('/sp/budgetRulesAssociation', method='POST')
249
+ def associate_budget_rules(self, **kwargs) -> ApiResponse:
250
+ r"""
251
+ Associates budget rules to one or more campaigns.
252
+
253
+ A maximum of 250 rules can be associated to a campaign, and each rule
254
+ name associated to a campaign must be unique.
255
+
256
+ Request Body [Required]
257
+ | **budgetRulesAssociations** (array): up to 50 items.
258
+ | **budgetRuleId** (string): [required] The rule identifier.
259
+ | **campaignId** (string): [required] The campaign identifier.
260
+
261
+ Returns:
262
+
263
+ ApiResponse
264
+
265
+ """
266
+ json_version = 'application/json'
267
+ headers = {"Accept": json_version, "Content-Type": json_version}
268
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
269
+
270
+ @sp_endpoint('/sp/budgetRulesAssociation/delete', method='POST')
271
+ def disassociate_budget_rules(self, **kwargs) -> ApiResponse:
272
+ r"""
273
+ Disassociates budget rules from one or more campaigns.
274
+
275
+ Request Body [Required]
276
+ | **budgetRulesDisAssociations** (array): up to 50 items.
277
+ | **budgetRuleId** (string): [required] The rule identifier.
278
+ | **campaignId** (string): [required] The campaign identifier.
279
+
280
+ Returns:
281
+
282
+ ApiResponse
283
+
284
+ """
285
+ json_version = 'application/json'
286
+ headers = {"Accept": json_version, "Content-Type": json_version}
287
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
@@ -0,0 +1,44 @@
1
+ from ad_api.base import Client, sp_endpoint, ApiResponse, Utils
2
+
3
+
4
+ class BudgetRulesRecommendations(Client):
5
+ @sp_endpoint('/sp/campaigns/budgetRules/recommendations', method='POST')
6
+ def list_campaigns_budget_rules_recommendations(self, version: int = 3, **kwargs) -> ApiResponse:
7
+ r"""
8
+ Gets a list of special events with suggested date range and suggested budget increase for a campaign specified by identifier.
9
+
10
+ Request Body (required)
11
+ | SPBudgetRulesRecommendationEventRequest {
12
+ | **campaignId**\* (string) The campaign identifier.
13
+ | }
14
+ Returns
15
+ ApiResponse
16
+ """
17
+ contentType = 'application/vnd.spbudgetrulesrecommendation.v' + str(version) + '+json'
18
+ headers = {'Content-Type': contentType, "Accept": contentType}
19
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
20
+
21
+ @sp_endpoint('/sp/v1/events', method='POST')
22
+ def list_rule_events(self, **kwargs) -> ApiResponse:
23
+ r"""
24
+ Gets every special event, individual and grouped, with the date range
25
+ suggested for each one.
26
+
27
+ A rule enables an automatic budget increase for a date range or for a
28
+ special event; this route is what tells you which events exist and
29
+ when, so a rule can point at one.
30
+
31
+ The body is empty and, unusually for this resource, the content type is
32
+ plain application/json rather than one of the application/vnd.sp...
33
+ types.
34
+
35
+ Returns:
36
+
37
+ ApiResponse
38
+ events and groupedEvents, each with its suggested date range.
39
+
40
+ """
41
+ json_version = 'application/json'
42
+
43
+ headers = {"Accept": json_version, "Content-Type": json_version}
44
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body', {}), False), params=kwargs, headers=headers)
@@ -0,0 +1,49 @@
1
+ from ad_api.base import Client, sp_endpoint, ApiResponse, Utils
2
+
3
+
4
+ class CampaignsRecommendations(Client):
5
+ @sp_endpoint('/sp/campaign/recommendations', method='GET')
6
+ def list_campaigns_recommendations(self, **kwargs) -> ApiResponse:
7
+ r"""
8
+ Gets the top consolidated recommendations across bid, budget, targeting for SP campaigns given an advertiser profile id. The recommendations are refreshed everyday.
9
+
10
+ Param:
11
+ | query **nextToken** (string). Optional. Token to retrieve subsequent page of results.
12
+ | query **maxResults** (string). Optional. Limits the number of items to return in the response.
13
+
14
+ Returns:
15
+
16
+ ApiResponse
17
+
18
+ """
19
+ return self._request(kwargs.pop('path'), params=kwargs)
20
+
21
+ @sp_endpoint('/sp/campaign/recommendations', method='POST')
22
+ def fetch_campaigns_recommendations(self, **kwargs) -> ApiResponse:
23
+ r"""
24
+ Gets the top consolidated recommendations for the campaigns named in the
25
+ body, one recommendation type per campaign. Refreshed every day.
26
+
27
+ The GET on the same path takes no body and returns every recommendation
28
+ the account has; this POST narrows it to the campaigns and types asked
29
+ for. It uses its own content type, v2, where the GET uses v1.
30
+
31
+ Request Body [Required]
32
+ | **campaigns** (array): 1 to 10 campaigns.
33
+ | **campaignId** (string): [required] The campaign identifier.
34
+ | **recommendationType** (string): [required] one of
35
+ | BIDDING_STRATEGY, BUDGET_STRATEGY, KEYWORD, KEYWORD_GROUP,
36
+ | PLACEMENT_BIDDING, SHOPPER_COHORT.
37
+ | **maxResults** (integer): 1 to 5. Defaults to 1.
38
+ | **nextToken** (string): Token for the next page.
39
+
40
+ Returns:
41
+
42
+ ApiResponse
43
+
44
+ """
45
+ json_version = 'application/vnd.spgetcampaignrecommendationsrequest.v2+json'
46
+ response_version = 'application/vnd.spgetcampaignrecommendationsresponse.v2+json'
47
+
48
+ headers = {"Accept": response_version, "Content-Type": json_version}
49
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
@@ -0,0 +1,97 @@
1
+ from ad_api.base import Client, sp_endpoint, ApiResponse, Utils
2
+
3
+
4
+ class GlobalRecommendations(Client):
5
+ r"""
6
+ Amazon Ads API - Sponsored Products recommendations across marketplaces.
7
+
8
+ These two routes answer for several countries at once, given the same
9
+ product or the same ad group in each of them, where the per-marketplace
10
+ routes answer for one country.
11
+
12
+ Both are version 5 of the same idea and both take a recommendationType
13
+ that decides which of two request shapes is expected:
14
+
15
+ BIDS_FOR_NEW_AD_GROUP / KEYWORDS_FOR_ASINS
16
+ a list of products, one per country
17
+ BIDS_FOR_EXISTING_AD_GROUP / KEYWORDS_FOR_ADGROUP
18
+ a campaign and ad group that already exist
19
+ """
20
+
21
+ @sp_endpoint('/sp/global/targets/bid/recommendations', method='POST')
22
+ def get_multi_country_bid_recommendations(self, **kwargs) -> ApiResponse:
23
+ r"""
24
+ Recommends bids for targets across several countries.
25
+
26
+ Two request shapes, chosen by recommendationType:
27
+
28
+ BIDS_FOR_EXISTING_AD_GROUP
29
+ adGroupId, campaignId, targetingExpressions, countryCodes.
30
+ BIDS_FOR_NEW_AD_GROUP
31
+ bidding, countryCodes, targetingExpressions, products.
32
+ No adGroupId and no campaignId, the ad group does not exist yet.
33
+
34
+ Request Body [Required]
35
+ | **recommendationType** (string): [required] one of the two above.
36
+ | **countryCodes** (array): target countries. Required by the
37
+ | new-ad-group shape.
38
+ | **targetingExpressions** (array): required by both shapes.
39
+ | **includeAnalysis** (boolean): defaults to false. Set it to true to
40
+ | get the estimated impressions for a range of eight bids per
41
+ | target. The contract says the analysis is only available for
42
+ | existing ad groups in the US marketplace.
43
+ | **adGroupId** (string): existing ad group only.
44
+ | **campaignId** (string): existing ad group only.
45
+ | **products** (array): new ad group only, a list of countryProducts.
46
+ | **bidding** (object): new ad group only.
47
+ | **strategy** (string): [required] the bidding strategy.
48
+ | **adjustments** (array): 1 to 3 placement adjustments.
49
+
50
+ A 422 comes back when the marketplace or the target is not supported.
51
+
52
+ Returns:
53
+
54
+ ApiResponse
55
+
56
+ """
57
+ json_version = 'application/json'
58
+ response_version = 'application/vnd.spthemebasedglobalbidrecommendation.v1+json'
59
+
60
+ headers = {"Accept": response_version, "Content-Type": json_version}
61
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
62
+
63
+ @sp_endpoint('/sp/global/targets/keywords/recommendations/list', method='POST')
64
+ def list_multi_country_keyword_recommendations(self, **kwargs) -> ApiResponse:
65
+ r"""
66
+ Recommends keyword targets, with their bids, across several countries.
67
+
68
+ Two request shapes, chosen by recommendationType:
69
+
70
+ KEYWORDS_FOR_ASINS
71
+ products, a list of countryProducts where each item maps a
72
+ two-letter country code to a product.
73
+ KEYWORDS_FOR_ADGROUP
74
+ adGroupId and campaignId of a global campaign and ad group.
75
+
76
+ Request Body [Required]
77
+ | **recommendationType** (string): [required] KEYWORDS_FOR_ASINS or
78
+ | KEYWORDS_FOR_ADGROUP.
79
+ | **products** (array): up to 50 countryProducts.
80
+ | **targets** (array): up to 100 countryTargets. Each one is an
81
+ | object with matchType and countryKeywords, a map from a
82
+ | two-letter country code to a keyword object.
83
+ | **adGroupId** (string): global ad group, second shape only.
84
+ | **campaignId** (string): global campaign, second shape only.
85
+
86
+ Each country is processed in parallel with the rules of version 5 of the
87
+ per-marketplace keyword recommendation route.
88
+
89
+ Returns:
90
+
91
+ ApiResponse
92
+
93
+ """
94
+ json_version = 'application/vnd.spkeywordsrecommendation.v5+json'
95
+
96
+ headers = {"Accept": json_version, "Content-Type": json_version}
97
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)