python-amazon-ad-api 1.4.1__py3-none-any.whl → 1.4.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.
ad_api/api/v1/__init__.py CHANGED
@@ -4,6 +4,7 @@ from .ads import Ads
4
4
  from .targets import Targets
5
5
  from .ad_extensions import AdExtensions
6
6
  from .advertiser_accounts import AdvertiserAccounts
7
+ from .ad_associations import AdAssociations
7
8
 
8
9
  __all__ = [
9
10
  "Campaigns",
@@ -12,4 +13,5 @@ __all__ = [
12
13
  "Targets",
13
14
  "AdExtensions",
14
15
  "AdvertiserAccounts",
16
+ "AdAssociations",
15
17
  ]
@@ -0,0 +1,138 @@
1
+ from ad_api.base import Client, sp_endpoint, ApiResponse, Utils
2
+
3
+
4
+ class AdAssociations(Client):
5
+ r"""
6
+ AdAssociations(account='default', marketplace: Marketplaces = Marketplaces.EU, credentials=None, debug=False)
7
+
8
+ Amazon Ads API v1 - unified AdAssociations endpoints
9
+
10
+ An ad association links one ``adId`` to one ``adGroupId`` and decides how
11
+ much of the group's traffic that ad receives. ``weight`` is the relative
12
+ percentage directed to the creative, and ``startDateTime`` / ``endDateTime``
13
+ bound when the association applies.
14
+
15
+ This is the first v1 family in this client with all four operations: the
16
+ others stop at update, while this one also has a delete.
17
+
18
+ Update cannot move an association to another ad or ad group: only the dates,
19
+ the state and the weight are accepted, so reassigning means delete and
20
+ create.
21
+
22
+ Like AdvertiserAccounts, this is not an ad-product resource and takes no
23
+ ``adProductFilter`` -- the query filters by association, ad group or ad.
24
+ """
25
+
26
+ @sp_endpoint('/adsApi/v1/query/adAssociations', method='POST')
27
+ def query_ad_associations(self, **kwargs) -> ApiResponse:
28
+ r"""
29
+ query_ad_associations(body: dict) -> ApiResponse
30
+
31
+ Amazon Ads API v1 - Query AdAssociations (operationId: QueryAdAssociation)
32
+
33
+ Request Body
34
+ | **adAssociationIdFilter** (dict) [optional]
35
+ | **include** (list<string>) : association identifiers
36
+ | **adGroupIdFilter** (dict) [optional]
37
+ | **include** (list<string>) : ad group identifiers
38
+ | **adIdFilter** (dict) [optional]
39
+ | **include** (list<string>) : ad identifiers
40
+ | **maxResults** (int) [optional] Maximum number of records in the response
41
+ | **nextToken** (string) [optional] Token to navigate to the next page
42
+
43
+ Returns
44
+ ApiResponse. ``payload`` holds ``adAssociations`` and ``nextToken``.
45
+ """
46
+ headers = {"Accept": "application/json", "Content-Type": "application/json"}
47
+ return self._request(
48
+ kwargs.pop('path'),
49
+ data=Utils.convert_body(kwargs.pop('body'), False),
50
+ params=kwargs,
51
+ headers=headers,
52
+ )
53
+
54
+ @sp_endpoint('/adsApi/v1/create/adAssociations', method='POST')
55
+ def create_ad_associations(self, **kwargs) -> ApiResponse:
56
+ r"""
57
+ create_ad_associations(body: dict) -> ApiResponse
58
+
59
+ Amazon Ads API v1 - Create AdAssociations (operationId: CreateAdAssociation)
60
+
61
+ Request Body [Required]
62
+ | **adAssociations** (list, 1..20) [required]
63
+
64
+ Each element:
65
+ | **adGroupId** (string) [required] the ad group the ad belongs to
66
+ | **adId** (string) [required] the ad being associated
67
+ | **state** (string) [required] Enum [ ENABLED, PAUSED ]
68
+ | **startDateTime** (string) [optional] when the association starts
69
+ | **endDateTime** (string) [optional] when it stops
70
+ | **weight** (integer) [optional] relative share of the ad
71
+ group's traffic directed to this creative
72
+
73
+ Returns
74
+ ApiResponse. Per-entity result carrying ``success`` and ``error``,
75
+ not the created objects.
76
+ """
77
+ headers = {"Accept": "application/json", "Content-Type": "application/json"}
78
+ return self._request(
79
+ kwargs.pop('path'),
80
+ data=Utils.convert_body(kwargs.pop('body'), False),
81
+ params=kwargs,
82
+ headers=headers,
83
+ )
84
+
85
+ @sp_endpoint('/adsApi/v1/update/adAssociations', method='POST')
86
+ def update_ad_associations(self, **kwargs) -> ApiResponse:
87
+ r"""
88
+ update_ad_associations(body: dict) -> ApiResponse
89
+
90
+ Amazon Ads API v1 - Update AdAssociations (operationId: UpdateAdAssociation)
91
+
92
+ The ad and the ad group cannot be changed here. To point the same creative
93
+ at a different ad, delete the association and create a new one.
94
+
95
+ Request Body [Required]
96
+ | **adAssociations** (list, 1..20) [required]
97
+
98
+ Each element:
99
+ | **adAssociationId** (string) [required] association to update
100
+ | **startDateTime** (string) [optional]
101
+ | **endDateTime** (string) [optional]
102
+ | **state** (string) [optional] Enum [ ENABLED, PAUSED, ARCHIVED ]
103
+ | **weight** (integer) [optional]
104
+
105
+ Returns
106
+ ApiResponse. Per-entity result carrying ``success`` and ``error``.
107
+ """
108
+ headers = {"Accept": "application/json", "Content-Type": "application/json"}
109
+ return self._request(
110
+ kwargs.pop('path'),
111
+ data=Utils.convert_body(kwargs.pop('body'), False),
112
+ params=kwargs,
113
+ headers=headers,
114
+ )
115
+
116
+ @sp_endpoint('/adsApi/v1/delete/adAssociations', method='POST')
117
+ def delete_ad_associations(self, **kwargs) -> ApiResponse:
118
+ r"""
119
+ delete_ad_associations(body: dict) -> ApiResponse
120
+
121
+ Amazon Ads API v1 - Delete AdAssociations (operationId: DeleteAdAssociation)
122
+
123
+ The array is named ``adAssociationIds`` here, not ``adAssociations`` as in
124
+ create and update. Sending the wrong name is a rejected request.
125
+
126
+ Request Body [Required]
127
+ | **adAssociationIds** (list, 1..20) [required] associations to delete
128
+
129
+ Returns
130
+ ApiResponse. Per-entity result carrying ``success`` and ``error``.
131
+ """
132
+ headers = {"Accept": "application/json", "Content-Type": "application/json"}
133
+ return self._request(
134
+ kwargs.pop('path'),
135
+ data=Utils.convert_body(kwargs.pop('body'), False),
136
+ params=kwargs,
137
+ headers=headers,
138
+ )
ad_api/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.4.1"
1
+ __version__ = "1.4.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-amazon-ad-api
3
- Version: 1.4.1
3
+ Version: 1.4.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
@@ -306,6 +306,7 @@ The v1 API lives under `/adsApi/v1/` and is **not** split by product: every call
306
306
  * [Targets](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/targets.html#ad_api.api.v1.Targets.Targets.query_targets)
307
307
  * [Ad Extensions](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/ad_extensions.html#ad_api.api.v1.AdExtensions.AdExtensions.query_ad_extensions)
308
308
  * [Advertiser Accounts](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/advertiser_accounts.html#ad_api.api.v1.AdvertiserAccounts.AdvertiserAccounts.query_advertiser_accounts)
309
+ * [Ad Associations](https://python-amazon-ad-api.readthedocs.io/en/latest/v1/ad_associations.html#ad_api.api.v1.AdAssociations.AdAssociations.query_ad_associations)
309
310
 
310
311
 
311
312
  ### [Modules Available Sponsored Products](https://python-amazon-ad-api.readthedocs.io/en/latest/sp.html)
@@ -1,5 +1,5 @@
1
1
  ad_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- ad_api/version.py,sha256=BqOI5y46o1G1RWC9bF1DPL-YM68lGYPmZt1pn6FZFZs,22
2
+ ad_api/version.py,sha256=qjngKmjcwKn1c_BwAouVdai-TbnuKZo56EbqRdILxaI,22
3
3
  ad_api/api/__init__.py,sha256=TLMefdmuyrj3-vtxGlzX4Sl-lHmE3Rs6daYgw3zwO0c,1600
4
4
  ad_api/api/account.py,sha256=CmOvCfHoPWaeTUJvtB0pNoNulZVSz4oMMCKIpVTpHos,2931
5
5
  ad_api/api/account_budgets.py,sha256=jFce5eLWAFK3ydjnYR7_Sv7B0-gHTG5bMTx_TcHyy1A,2319
@@ -89,7 +89,8 @@ ad_api/api/sp/product_recommendations.py,sha256=vXoZIRqcFc5bo9MUprArKndxcEYe_Puy
89
89
  ad_api/api/sp/product_targeting_v3.py,sha256=vk_T0piHzP5uwt8HSHm5hFKP_0sXJD8nbyooPtM-BTs,9567
90
90
  ad_api/api/sp/ranked_keywords_recommendations.py,sha256=QYFje19TFmwhedh7sn5VJIypL8gp6d6tpBQCpf_SIXw,13094
91
91
  ad_api/api/sp/schedule_based_bid_optimization.py,sha256=G8VkS7iP1lTIAxZgbfRCLz8njw1DkVH9HQPOZ63pWNU,2371
92
- ad_api/api/v1/__init__.py,sha256=PZUV64EpTwGeZaEJQO5GBr4WKloUaFPh2H55IidNscM,327
92
+ ad_api/api/v1/__init__.py,sha256=3fJ65Nj9aLyfLME_jXs6uAm7PlhfxBN4q-HDHmPuPcc,393
93
+ ad_api/api/v1/ad_associations.py,sha256=g5L8hAIagmsb-yQ09hP7z1zbVVe868NlpOOokv-Mouc,5812
93
94
  ad_api/api/v1/ad_extensions.py,sha256=kL-7xHaXXqb2jXTwZrY0oGttLAG0CW_IjBAqL_CI92U,5519
94
95
  ad_api/api/v1/ad_groups.py,sha256=pQhCVdve_O6kbL4mBA5bxxhKcKNl_BKqa7z9DvrxwaM,12626
95
96
  ad_api/api/v1/ads.py,sha256=YwZGQ-4WuYquleELtwRI9L8w0fGw7FBRejQE-tZ5hKY,7941
@@ -111,8 +112,8 @@ ad_api/base/exceptions.py,sha256=9D3M40ZIlLS0fA-aQh1BTWPOW-Nvf0tRhbA85jFnDJ4,438
111
112
  ad_api/base/helpers.py,sha256=UK7Q13vZ0mNdF54xzfzoGDn2O_cd2yPrK2X4rOzC41c,2334
112
113
  ad_api/base/marketplaces.py,sha256=44lvCcluXNpqTprWQ80e3weSQmQbJoWL-WDSOWVbCyQ,4657
113
114
  ad_api/base/utils.py,sha256=_qnCBOvyJTLgaZjJzUWTi38GGLHkQszXELs79133Rb4,5618
114
- python_amazon_ad_api-1.4.1.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
115
- python_amazon_ad_api-1.4.1.dist-info/METADATA,sha256=60IbkJFCBtnuSn85xriw-jm_P-9LPPXvSvY9FmktSEw,21893
116
- python_amazon_ad_api-1.4.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
117
- python_amazon_ad_api-1.4.1.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
118
- python_amazon_ad_api-1.4.1.dist-info/RECORD,,
115
+ python_amazon_ad_api-1.4.2.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
116
+ python_amazon_ad_api-1.4.2.dist-info/METADATA,sha256=TZgn0q-QwBVCAt_0gsLvXBZEsGjZ9UaGp6OFzlnk_aI,22058
117
+ python_amazon_ad_api-1.4.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
118
+ python_amazon_ad_api-1.4.2.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
119
+ python_amazon_ad_api-1.4.2.dist-info/RECORD,,