python-amazon-ad-api 1.1.0__py3-none-any.whl → 1.1.2__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.
@@ -58,6 +58,7 @@ class AdCreativesV4(Client):
58
58
  return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
59
59
 
60
60
  @sp_endpoint('/sb/ads/creatives/productCollection', method='POST')
61
+ @Utils.deprecated
61
62
  def create_new_version_product_collection_ad_creative(self, version: int = 4, **kwargs) -> ApiResponse:
62
63
  """
63
64
  Creates a new version of creative for given Sponsored Brands ad by supplying product collection creative content.
@@ -91,10 +92,10 @@ class AdCreativesV4(Client):
91
92
 
92
93
  return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
93
94
 
94
- @sp_endpoint('/sb/ads/creatives/productCollection', method='POST')
95
+ @sp_endpoint('/sb/ads/creatives/storeSpotlight', method='POST')
95
96
  def create_new_version_store_spotlight_ad_creative(self, version: int = 4, **kwargs) -> ApiResponse:
96
97
  """
97
- Creates a new version of creative for given Sponsored Brands ad by supplying product collection creative content.
98
+ Creates a new version of creative for a given Sponsored Brands ad by supplying store spotlight creative content.
98
99
 
99
100
  Request Body [Required]
100
101
  | **adId** (string) : The unique ID of a Sponsored Brands ad.
ad_api/api/sb/forecast.py CHANGED
@@ -2,6 +2,89 @@ from ad_api.base import Client, sp_endpoint, ApiResponse, Utils
2
2
 
3
3
 
4
4
  class Forecast(Client):
5
- @sp_endpoint('/sb/campaigns/shopperSegments/forecast', method='POST')
6
- def list_forecast(self, **kwargs) -> ApiResponse:
7
- return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs)
5
+ """Sponsored Brands campaign performance forecasts.
6
+
7
+ Documentation: https://advertising.amazon.com/API/docs/en-us/sponsored-brands/4-0/openapi#tag/Forecasting
8
+
9
+ .. warning::
10
+ The Amazon backend for this route answers ``500 InternalFailure`` with an
11
+ empty body once the request passes validation. Verified from every angle:
12
+ keywords, targets, themes with landing pages, and mixed ad groups all fail
13
+ the same way, while the validation rules themselves do answer correctly
14
+ (``400`` with a business message). The client is built to the contract, so
15
+ it will work unchanged once Amazon fixes the service.
16
+
17
+ Validation rules observed against the live service, not in the contract:
18
+
19
+ * ``themes`` require ``landingPages``:
20
+ *"LandingPageUrl list is null or empty but theme list is not empty"*.
21
+ * An ad group with only ``landingPages`` is rejected:
22
+ *"Ad group is null or missing required fields"*; it needs something to bid on.
23
+ """
24
+
25
+ _ACCEPT = 'application/vnd.sbforecasting.v4+json'
26
+
27
+ @classmethod
28
+ def _accept(cls):
29
+ return {"Accept": cls._ACCEPT, "Content-Type": cls._ACCEPT}
30
+
31
+ @sp_endpoint('/sb/forecasts', method='POST')
32
+ def list_forecast(self, campaigns, version: int = 4, **kwargs) -> ApiResponse:
33
+ r"""
34
+ Gets performance forecasts for new campaigns.
35
+
36
+ ``campaigns`` is the list under the required ``campaigns`` key, ready to
37
+ send: the method wraps it in ``{"campaigns": [...]}``.
38
+
39
+ Positional Args
40
+ | **campaigns** (list): One or more campaign objects. The contract
41
+ states only one new campaign is supported for now.
42
+
43
+ Keyword Args
44
+ | **version** (int): Media type version, ``4`` by default.
45
+
46
+ Campaign object
47
+ | **budget** (number): [required] Budget amount.
48
+ | **budgetType** (string): [required] ``DAILY`` or ``LIFETIME``.
49
+ | **forecastType** (string): [required] ``WEEKLY`` or ``MONTHLY``.
50
+ | **adGroups** (list): [required] Ad groups to forecast.
51
+ | **startDate** (string): ``YYYY-MM-DD``.
52
+ | **endDate** (string): ``YYYY-MM-DD``, later than ``startDate``.
53
+ | **goal** (string): ``PAGE_VISIT``, ``BRAND_IMPRESSION_SHARE``,
54
+ ``ACQUIRE_NEW_CUSTOMERS`` or ``AD_VIEWS``. Defaults to ``PAGE_VISIT``
55
+ when the campaign was created without a goal.
56
+
57
+ Ad group object
58
+ | **keywords** (list): ``keywordText``, ``matchType`` and ``bid``.
59
+ | **targets** (list): ``expressions`` and ``bid``.
60
+ | **themes** (list): ``themeType`` and ``bid``. Requires landingPages.
61
+ | **landingPages** (list): ``landingPageUrl``.
62
+ | **negativeKeywords** (list): ``keywordText`` and ``matchType``.
63
+ | **negativeTargets** (list): ``expressions``.
64
+ | **creativeAsins** (list): ASINs used by the creative.
65
+
66
+ Returns:
67
+ | ApiResponse, with status ``207`` on success.
68
+
69
+ Example::
70
+
71
+ forecast = Forecast(account='account_name')
72
+ response = forecast.list_forecast(campaigns=[{
73
+ "budget": 100,
74
+ "budgetType": "DAILY",
75
+ "forecastType": "WEEKLY",
76
+ "startDate": "2026-11-01",
77
+ "endDate": "2026-11-30",
78
+ "goal": "PAGE_VISIT",
79
+ "adGroups": [{
80
+ "themes": [{"themeType": "KEYWORDS_RELATED_TO_YOUR_BRAND", "bid": 0.5}],
81
+ "landingPages": [{"landingPageUrl": "https://www.amazon.es/stores/page/XXXX"}],
82
+ }],
83
+ }])
84
+ """
85
+ return self._request(
86
+ kwargs.pop('path'),
87
+ data=Utils.convert_body({'campaigns': campaigns}, False),
88
+ params=kwargs,
89
+ headers=self._accept(),
90
+ )
ad_api/api/sb/media.py CHANGED
@@ -6,6 +6,13 @@ class Media(Client):
6
6
  Use this interface to request and retrieve store information. This can be used for Sponsored Brands campaign creation, to pull the store URL information, and for asset registration for Stores.
7
7
  """
8
8
 
9
+ # NOTE: /media/upload and /media/complete are NOT in the v3 contract.
10
+ # Probing /media/upload answers 403 IncompleteSignatureException before the
11
+ # router sees it, which suggests the route expects an AWS SigV4 signature
12
+ # rather than the bearer token this client sends. Not verified either way.
13
+ # /media/complete answers 500 with a NullPointerException on an empty body,
14
+ # so the route exists but its expected fields are unknown.
15
+
9
16
  @sp_endpoint('/media/upload', method='POST')
10
17
  def create_media(self, **kwargs) -> ApiResponse:
11
18
  """
@@ -30,5 +37,19 @@ class Media(Client):
30
37
  return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs)
31
38
 
32
39
  @sp_endpoint('/media/describe', method='GET')
33
- def describe_media(self, **kwargs) -> ApiResponse:
34
- return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs)
40
+ def describe_media(self, mediaId, **kwargs) -> ApiResponse:
41
+ """
42
+ Describes an uploaded media resource.
43
+
44
+ The media id goes in the query string. Answered ``400 InvalidMediaId``
45
+ for an id that does not exist, which means the route is live.
46
+
47
+ Keyword Args
48
+ | path **mediaId** (string): The media identifier. [required]
49
+
50
+ Returns:
51
+ | ApiResponse
52
+
53
+ Documentation: https://advertising.amazon.com/API/docs/en-us/sponsored-brands/3-0/openapi
54
+ """
55
+ return self._request(kwargs.pop('path'), params={'mediaId': mediaId, **kwargs})
@@ -2,6 +2,6 @@ from ad_api.base import Client, sp_endpoint, ApiResponse, Utils
2
2
 
3
3
 
4
4
  class Recommendations(Client):
5
- @sp_endpoint('/sb​/recommendations​/creative​/headline', method='POST')
5
+ @sp_endpoint('/sb/recommendations/creative/headline', method='POST')
6
6
  def list_recommendations(self, **kwargs) -> ApiResponse:
7
7
  return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs)
ad_api/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.1.0"
1
+ __version__ = "1.1.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-amazon-ad-api
3
- Version: 1.1.0
3
+ Version: 1.1.2
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
@@ -1,5 +1,5 @@
1
1
  ad_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- ad_api/version.py,sha256=LGVQyDsWifdACo7qztwb8RWWHds1E7uQ-ZqD8SAjyw4,22
2
+ ad_api/version.py,sha256=5SgGjThsHu_ITn8V83BvCziqCwxdXxTQqcC3KQMHPfM,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
@@ -25,7 +25,7 @@ ad_api/api/stores.py,sha256=7W3RJKZyZOQ3nHzInvK9FDhWTXCH6Xe9a6dCBatEZ-o,2484
25
25
  ad_api/api/stream.py,sha256=JpnF8SKniOAHiEnEq1RPrh6tNy-Q2-8GPBTmnlxEXqQ,2989
26
26
  ad_api/api/validation_configurations.py,sha256=V3o06uWGwvA_Ly1x2lAiCk35Wo7DC_k8AtHgMdpm6wU,3830
27
27
  ad_api/api/sb/__init__.py,sha256=Lb7biv_idmsN6SkObBhQS4hZs3rdeQr0ytSvcl2tfSo,1274
28
- ad_api/api/sb/ad_creatives_v4.py,sha256=VwBDMnYdf10wtP6bVnTQjOLp7ZzJYueU_q_xN6Yxie4,10490
28
+ ad_api/api/sb/ad_creatives_v4.py,sha256=86sF2lhSc3AC6d4P5TXyEnJMBjn9HvsJe4bbCQbSWK0,10508
29
29
  ad_api/api/sb/ad_groups.py,sha256=W06Fk0CCsuEYen1Bd8obR6aHpOMhk6tGWNWApecw59c,2882
30
30
  ad_api/api/sb/ad_groups_v4.py,sha256=f6KpOrJ2RsCa4aznP8vdGbXp0HGsCmLOvC9yXX2pESc,3669
31
31
  ad_api/api/sb/ads_v4.py,sha256=EOn-ts0cPqCwt5vdGq6rkDHyYPoT6vbDP8UQE-TFjmE,7931
@@ -34,15 +34,15 @@ 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/campaigns.py,sha256=41yRnrgvx4-9Zra7Zdqtzr2Ptq__YD-mHOWbACaEQOk,13674
36
36
  ad_api/api/sb/campaigns_v4.py,sha256=_SfEQhHCS90UaSxOq35mm7NAr2BVpqJ4gzAbauVCZiA,7290
37
- ad_api/api/sb/forecast.py,sha256=hFOYQi4qlvsIkTRiqiexiI4XRv1tWmdnvQZk9Sl641A,334
37
+ ad_api/api/sb/forecast.py,sha256=qf2ivhGX3_dv_uMGP9cmrt_x3S7QLg-P_5nCI8bAr00,3967
38
38
  ad_api/api/sb/keywords.py,sha256=P1dGqcLia349O0CwpBRURlIzgRc0cbFotkAGTSrErt4,7634
39
39
  ad_api/api/sb/keywords_recommendations.py,sha256=oA4FRBwDtk52SZK0RgWvjNQ7K2GX0G2zSoisJGiEYDw,629
40
40
  ad_api/api/sb/landing_page_asins.py,sha256=j3qi2-KccuEzGLZrl6EfZBSikW2R4B4l7TixpkAnTq8,1259
41
- ad_api/api/sb/media.py,sha256=wHa91d9qQb-bvBS5vaeNqlaAJ60iITedj-Hr9yR5aaw,1634
41
+ ad_api/api/sb/media.py,sha256=5LTeM4AHSDKw_58aTB2nEZhIYdWkztH0syBXaovS1rs,2529
42
42
  ad_api/api/sb/negative_keywords.py,sha256=ww3IRbawidDHAaYIkX5SsH2OZKJj4UnCylqqFeq3OoY,6918
43
43
  ad_api/api/sb/negative_product_targeting.py,sha256=QbK1EhhzmnNOzGtbkrAZ4HS5OqiLU3nZBmsl1scd2D0,5085
44
44
  ad_api/api/sb/product_targeting.py,sha256=o6aB3hIh9jKvi_uTXFi--1hpnPFuXzQ-U9N7VUP_Bz4,5362
45
- ad_api/api/sb/recommendations.py,sha256=Ck4DLAKLTqwodmQJfih9MUD1sujG6LDjRlSoefKmOC4,356
45
+ ad_api/api/sb/recommendations.py,sha256=_21L8tZPuArmJ30XyR1SKQHQH_yswvF0IMqwD9sLhgY,347
46
46
  ad_api/api/sb/reports.py,sha256=icw5DpRrqfj0idEo0NN1GPDpIWQun2h_c2Uwc7CpNUA,3801
47
47
  ad_api/api/sb/stores.py,sha256=sLdA6Lp37VR-ldu_sTUZIqc8MbMzysPhNOh05VaKBcA,4371
48
48
  ad_api/api/sb/targeting_recommendations.py,sha256=_7NxD5kC-Od11QOuLT03qpLVxEOIZgy-BtzniWK4CI8,2862
@@ -104,8 +104,8 @@ ad_api/base/exceptions.py,sha256=9D3M40ZIlLS0fA-aQh1BTWPOW-Nvf0tRhbA85jFnDJ4,438
104
104
  ad_api/base/helpers.py,sha256=naUkDLK466x_OBCPXxMlzRc2nPC6iQ6H_vyUji0MJJ0,2282
105
105
  ad_api/base/marketplaces.py,sha256=44lvCcluXNpqTprWQ80e3weSQmQbJoWL-WDSOWVbCyQ,4657
106
106
  ad_api/base/utils.py,sha256=_qnCBOvyJTLgaZjJzUWTi38GGLHkQszXELs79133Rb4,5618
107
- python_amazon_ad_api-1.1.0.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
108
- python_amazon_ad_api-1.1.0.dist-info/METADATA,sha256=tTSo2QGb0e6DIYzbUPaIclYQ1iLHTZ-OlglceAaMvGw,20486
109
- python_amazon_ad_api-1.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
110
- python_amazon_ad_api-1.1.0.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
111
- python_amazon_ad_api-1.1.0.dist-info/RECORD,,
107
+ python_amazon_ad_api-1.1.2.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
108
+ python_amazon_ad_api-1.1.2.dist-info/METADATA,sha256=jEhN9JfVx95NGB5WsqesHlubfW8jfCOTmYFRofcUMAs,20486
109
+ python_amazon_ad_api-1.1.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
110
+ python_amazon_ad_api-1.1.2.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
111
+ python_amazon_ad_api-1.1.2.dist-info/RECORD,,