python-amazon-ad-api 1.1.7__py3-none-any.whl → 1.1.9__py3-none-any.whl

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.
@@ -77,6 +77,34 @@ class CampaignsV4(Client):
77
77
 
78
78
  return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
79
79
 
80
+ @sp_endpoint('/sb/campaigns/insights', method='POST')
81
+ def get_campaign_insights(self, version: int = 4, **kwargs) -> ApiResponse:
82
+ """
83
+ Gets insights for campaign ad groups.
84
+
85
+ Request Body [Required]
86
+ | **adGroups** (array): [required] One entry per ad group.
87
+ | **adFormat** (string): [required] Ad format of the ad group.
88
+ | **keywords** (array): [optional] Each entry needs
89
+ ``keywordText``, ``matchType`` and ``bid``.
90
+
91
+ Returns:
92
+ | ApiResponse, ``200``.
93
+
94
+ .. note::
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.
98
+
99
+ .. note::
100
+ An empty body answers ``400`` naming ``adGroups``, which is the only
101
+ required member.
102
+ """
103
+ json_version = 'application/vnd.sbinsights.v' + str(version) + "+json"
104
+ headers = {'Accept': json_version}
105
+
106
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
107
+
80
108
  @sp_endpoint('/sb/v4/campaigns/list', method='POST')
81
109
  def list_campaigns(self, version: int = 4, **kwargs) -> ApiResponse:
82
110
  """
@@ -67,6 +67,29 @@ class TargetingCategories(Client):
67
67
  params=kwargs,
68
68
  headers={'Accept': self._MEDIA, 'Content-Type': self._MEDIA})
69
69
 
70
+ @sp_endpoint('/sb/negativeTargets/brands/recommendations', method='GET')
71
+ def list_negative_brand_recommendations(self, **kwargs) -> ApiResponse:
72
+ """
73
+ Gets brand recommendations for negative targeting.
74
+
75
+ Keyword Args
76
+ | query **nextToken** (string): [optional] Pagination token.
77
+
78
+ Returns:
79
+ | ApiResponse, ``200``, with brands under ``brands``, each carrying
80
+ ``brandRefinementId`` and ``name``.
81
+
82
+ Example::
83
+
84
+ {"brands": [{"brandRefinementId": "19897490031", "name": "YEYIAN"}]}
85
+
86
+ .. note::
87
+ Lives here because it shares this class media type. It is the one
88
+ route in this class that is not about the category tree.
89
+ """
90
+ return self._request(kwargs.pop('path'), params=kwargs,
91
+ headers={'Accept': self._MEDIA, 'Content-Type': self._MEDIA})
92
+
70
93
  @sp_endpoint('/sb/targets/products/count', method='POST')
71
94
  def get_product_count(self, category, **kwargs) -> ApiResponse:
72
95
  """
ad_api/base/helpers.py CHANGED
@@ -1,3 +1,4 @@
1
+ import functools
1
2
  from io import BytesIO
2
3
  from typing import TypeVar
3
4
 
@@ -17,6 +18,7 @@ T = TypeVar("T")
17
18
 
18
19
  def sp_endpoint(path, method="GET"):
19
20
  def decorator(function: T) -> T:
21
+ @functools.wraps(function)
20
22
  def wrapper(*args, **kwargs):
21
23
  kwargs.update({"path": path, "method": method})
22
24
  return function(*args, **kwargs)
ad_api/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.1.7"
1
+ __version__ = "1.1.9"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-amazon-ad-api
3
- Version: 1.1.7
3
+ Version: 1.1.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
@@ -343,24 +343,35 @@ Warning: the campaign, ad group and product ad operations are deprecated in favo
343
343
  * [Ad Groups (deprecated)](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ad_groups.html)
344
344
  * [Keywords](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/keywords.html)
345
345
  * [Negative Keywords](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/negative_keywords.html)
346
+ * [Keywords Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/keywords_recommendations.html)
346
347
  * [Product Targeting](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/product_targeting.html)
347
348
  * [Negative Product Targeting](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/negative_product_targeting.html)
348
349
  * [Targeting Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/targeting_recommendations.html)
349
350
  * [Bid Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/bid_recommendations.html)
351
+ * [Benchmarks](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/benchmarks.html)
350
352
  * [Stores](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/stores.html)
351
353
  * [Landing Page Asins](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/landing_page_asins.html)
352
354
  * [Media](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/media.html)
353
355
  * [Brands](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/brands.html)
354
- * [Moderation](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/moderation.html)
355
- * [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/reports.html)
356
- * [Snapshots](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/snapshots.html)
357
356
  * [Themes](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/themes.html)
357
+ * [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/reports.html)
358
358
 
359
359
  ### [Modules Available Sponsored Brands 4.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sb_v4.html)
360
360
 
361
+ > The 4.0 contract is fully covered: every operation is implemented except the campaign moderation route, which the service answers with a router `404`, and the report download, which resolves through the shared `_download` helper.
362
+
361
363
  * [Campaigns](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/campaigns_v4.html)
362
364
  * [Ad Groups](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ad_groups_v4.html)
363
- * [Ads Groups](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ads_v4.html)
365
+ * [Ads](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ads_v4.html)
366
+ * [Ad Creatives](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/ad_creatives_v4.html)
367
+ * [Forecast](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/forecast.html)
368
+ * [Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/recommendations.html)
369
+ * [Budget Rules](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/budget_rules.html)
370
+ * [Optimization Rules](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/optimization_rules.html)
371
+ * [Targeting Categories](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/targeting_categories.html)
372
+ * [Migration](https://python-amazon-ad-api.readthedocs.io/en/latest/sb/migration.html)
373
+
374
+ > Most 4.0 routes take a versioned media type and the service routes on it. With `application/json` they answer `404 Could not find resource`, which reads like a missing route but is only the wrong media type. This affects forecasts, budget recommendations, optimization rules, migrations, insights, negative brand recommendations and the collection creatives.
364
375
 
365
376
  ### [Modules Available Sponsored Display](https://python-amazon-ad-api.readthedocs.io/en/latest/sd.html)
366
377
 
@@ -1,5 +1,5 @@
1
1
  ad_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- ad_api/version.py,sha256=p2qAfdU7zHOShJi2f1FW-_7Tbm0-KCPE7CI7284QiHg,22
2
+ ad_api/version.py,sha256=lnHAM_YSOt5TvtAm4ZVs32T0TpsCQ5kOOznnQlur1YE,22
3
3
  ad_api/api/__init__.py,sha256=E9c0ZyK4vplMlKKEBF8CV5u7P4uSkTMSQsAuSQu5bfY,1514
4
4
  ad_api/api/account.py,sha256=CmOvCfHoPWaeTUJvtB0pNoNulZVSz4oMMCKIpVTpHos,2931
5
5
  ad_api/api/advertising_test_account.py,sha256=btOVbdk2tBDmyKSJaQbcIFyzNG8KFJVUmTe4p9xMhpU,1507
@@ -34,7 +34,7 @@ ad_api/api/sb/bid_recommendations.py,sha256=ssO9XwYC9wK2GFaLtcsC-D3cZhDpCclcu1r0
34
34
  ad_api/api/sb/brands.py,sha256=XIMDzV0tJoPiOcY0KoCKcyIwYLPMlJ-zkB2SeRVMF4Q,1376
35
35
  ad_api/api/sb/budget_rules.py,sha256=8hyJ4yD-myR4atYmTm8KsTSB5ZNfASGe2fxgwRv4SRs,10029
36
36
  ad_api/api/sb/campaigns.py,sha256=41yRnrgvx4-9Zra7Zdqtzr2Ptq__YD-mHOWbACaEQOk,13674
37
- ad_api/api/sb/campaigns_v4.py,sha256=_SfEQhHCS90UaSxOq35mm7NAr2BVpqJ4gzAbauVCZiA,7290
37
+ ad_api/api/sb/campaigns_v4.py,sha256=F50vFI2qyIKssEhPFCu4NXnq9trSIGywVNA5uVpp6rc,8504
38
38
  ad_api/api/sb/forecast.py,sha256=qf2ivhGX3_dv_uMGP9cmrt_x3S7QLg-P_5nCI8bAr00,3967
39
39
  ad_api/api/sb/keywords.py,sha256=P1dGqcLia349O0CwpBRURlIzgRc0cbFotkAGTSrErt4,7634
40
40
  ad_api/api/sb/keywords_recommendations.py,sha256=oA4FRBwDtk52SZK0RgWvjNQ7K2GX0G2zSoisJGiEYDw,629
@@ -48,7 +48,7 @@ ad_api/api/sb/product_targeting.py,sha256=o6aB3hIh9jKvi_uTXFi--1hpnPFuXzQ-U9N7VU
48
48
  ad_api/api/sb/recommendations.py,sha256=_21L8tZPuArmJ30XyR1SKQHQH_yswvF0IMqwD9sLhgY,347
49
49
  ad_api/api/sb/reports.py,sha256=icw5DpRrqfj0idEo0NN1GPDpIWQun2h_c2Uwc7CpNUA,3801
50
50
  ad_api/api/sb/stores.py,sha256=sLdA6Lp37VR-ldu_sTUZIqc8MbMzysPhNOh05VaKBcA,4371
51
- ad_api/api/sb/targeting_categories.py,sha256=mTU3hMEW_orG_D2mlTqUX14DEDPn9A11vH-wntECklk,4212
51
+ ad_api/api/sb/targeting_categories.py,sha256=QqOB2vTiS5c8u9qvbjRpeKJdGBkMWfgwWSoF3h-Eg4c,5114
52
52
  ad_api/api/sb/targeting_recommendations.py,sha256=_7NxD5kC-Od11QOuLT03qpLVxEOIZgy-BtzniWK4CI8,2862
53
53
  ad_api/api/sb/themes.py,sha256=rjxdGcllaqLOUMoTKKgBVSH5iKuxMdF0w-dHq0X3-yU,4618
54
54
  ad_api/api/sd/__init__.py,sha256=RulShFVpowt2L_ZMcifFVgVrQEg5Uf9_SlVRydUnTF4,911
@@ -105,11 +105,11 @@ ad_api/base/client.py,sha256=rOTH5zd513qmeNiJbwT42kEXvZseeh03UUp-krBW_W4,10322
105
105
  ad_api/base/config.py,sha256=VbykwPyR_CDIMFCZQs_GSqc5qKcYpp0l6B9luV-abu4,606
106
106
  ad_api/base/credential_provider.py,sha256=upgcgm2GGb0AkzDlKVAtKtbirqZAFp3EM6DkBzvAXsI,5566
107
107
  ad_api/base/exceptions.py,sha256=9D3M40ZIlLS0fA-aQh1BTWPOW-Nvf0tRhbA85jFnDJ4,4383
108
- ad_api/base/helpers.py,sha256=naUkDLK466x_OBCPXxMlzRc2nPC6iQ6H_vyUji0MJJ0,2282
108
+ ad_api/base/helpers.py,sha256=UK7Q13vZ0mNdF54xzfzoGDn2O_cd2yPrK2X4rOzC41c,2334
109
109
  ad_api/base/marketplaces.py,sha256=44lvCcluXNpqTprWQ80e3weSQmQbJoWL-WDSOWVbCyQ,4657
110
110
  ad_api/base/utils.py,sha256=_qnCBOvyJTLgaZjJzUWTi38GGLHkQszXELs79133Rb4,5618
111
- python_amazon_ad_api-1.1.7.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
112
- python_amazon_ad_api-1.1.7.dist-info/METADATA,sha256=ySlzzw2eMqLcY38Pk2d32nnEH-zGKjcnpoB-PQ5fz2E,20486
113
- python_amazon_ad_api-1.1.7.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
114
- python_amazon_ad_api-1.1.7.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
115
- python_amazon_ad_api-1.1.7.dist-info/RECORD,,
111
+ python_amazon_ad_api-1.1.9.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
112
+ python_amazon_ad_api-1.1.9.dist-info/METADATA,sha256=3q_mes0kMmFRFV8eOrOBxDmWYui2SNDT1CH3ZzRD0kg,21778
113
+ python_amazon_ad_api-1.1.9.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
114
+ python_amazon_ad_api-1.1.9.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
115
+ python_amazon_ad_api-1.1.9.dist-info/RECORD,,