python-amazon-ad-api 2.3.1__py3-none-any.whl → 2.4.0__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/__init__.py +62 -0
- ad_api/api/dsp_ad_group_and_campaign.py +139 -0
- ad_api/api/dsp_audience_create.py +53 -0
- ad_api/api/dsp_bid_adjustments.py +193 -0
- ad_api/api/dsp_campaign_flights.py +119 -0
- ad_api/api/dsp_campaign_insights.py +59 -0
- ad_api/api/dsp_combined_audiences.py +83 -0
- ad_api/api/dsp_conversion_tracking_products.py +92 -0
- ad_api/api/dsp_conversions.py +442 -0
- ad_api/api/dsp_creatives.py +114 -0
- ad_api/api/dsp_deal_permissions.py +170 -0
- ad_api/api/dsp_deal_proposals.py +440 -0
- ad_api/api/dsp_deals.py +204 -0
- ad_api/api/dsp_deals_management.py +66 -0
- ad_api/api/dsp_discovery_advertised_product_categories.py +35 -0
- ad_api/api/dsp_discovery_apps.py +36 -0
- ad_api/api/dsp_discovery_domain_lists.py +36 -0
- ad_api/api/dsp_discovery_geo_locations.py +42 -0
- ad_api/api/dsp_discovery_iab_content.py +37 -0
- ad_api/api/dsp_discovery_inventory_source_exchanges.py +36 -0
- ad_api/api/dsp_discovery_products.py +102 -0
- ad_api/api/dsp_discovery_third_party_target_segments.py +36 -0
- ad_api/api/dsp_frequency_associations.py +138 -0
- ad_api/api/dsp_frequency_groups.py +112 -0
- ad_api/api/dsp_frequency_insights.py +85 -0
- ad_api/api/dsp_guidance.py +111 -0
- ad_api/api/dsp_inherited_settings.py +133 -0
- ad_api/api/dsp_inventory_groups.py +209 -0
- ad_api/api/dsp_measurement.py +693 -0
- ad_api/api/dsp_seats.py +43 -0
- ad_api/api/dsp_target_kpi_recommendations.py +44 -0
- ad_api/api/dsp_targeting.py +98 -0
- ad_api/version.py +1 -1
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/METADATA +1 -1
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/RECORD +38 -7
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/WHEEL +0 -0
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
"""Deal proposals /dsp/inventory/proposal*.
|
|
2
|
+
|
|
3
|
+
Contract: Deal Proposals 3.0. Eighteen operations over sixteen paths, in two
|
|
4
|
+
families: proposals (``dspproposalResource``) and proposed deals
|
|
5
|
+
(``dspproposedDealResource``). Signals have a third,
|
|
6
|
+
``dspsignalCollectionsResource``.
|
|
7
|
+
|
|
8
|
+
**207 on the writes**, 200 on the reads and on the status updates.
|
|
9
|
+
``Amazon-Advertising-API-ClientId`` and ``Amazon-Ads-AccountId`` are required,
|
|
10
|
+
``Scope`` is optional.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DspDealProposals(Client):
|
|
17
|
+
r"""Deal proposals - /dsp/inventory/proposal*
|
|
18
|
+
|
|
19
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/deal-proposals
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@sp_endpoint('/dsp/inventory/proposals/list', method='POST',
|
|
23
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
24
|
+
def list_proposals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
25
|
+
r"""
|
|
26
|
+
Lists proposals. Read only.
|
|
27
|
+
|
|
28
|
+
Keyword Args
|
|
29
|
+
|
|
30
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
31
|
+
|
|
32
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
ApiResponse, ``200``, with the proposals.
|
|
36
|
+
"""
|
|
37
|
+
media_type = 'application/vnd.dspproposalResource.v' + version + '+json'
|
|
38
|
+
headers = {'Accept': media_type}
|
|
39
|
+
headers['Content-Type'] = media_type
|
|
40
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
41
|
+
return self._request(kwargs.pop('path'),
|
|
42
|
+
data=body, params=kwargs, headers=headers)
|
|
43
|
+
|
|
44
|
+
@sp_endpoint('/dsp/inventory/proposals', method='POST',
|
|
45
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
46
|
+
def create_proposals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
47
|
+
r"""
|
|
48
|
+
Creates proposals.
|
|
49
|
+
|
|
50
|
+
Keyword Args
|
|
51
|
+
|
|
52
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
53
|
+
|
|
54
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
ApiResponse, **207** multi-status.
|
|
58
|
+
"""
|
|
59
|
+
media_type = 'application/vnd.dspproposalResource.v' + version + '+json'
|
|
60
|
+
headers = {'Accept': media_type}
|
|
61
|
+
headers['Content-Type'] = media_type
|
|
62
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
63
|
+
return self._request(kwargs.pop('path'),
|
|
64
|
+
data=body, params=kwargs, headers=headers)
|
|
65
|
+
|
|
66
|
+
@sp_endpoint('/dsp/inventory/proposals', method='PUT',
|
|
67
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
68
|
+
def update_proposals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
69
|
+
r"""
|
|
70
|
+
Updates proposals in bulk.
|
|
71
|
+
|
|
72
|
+
Keyword Args
|
|
73
|
+
|
|
74
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
75
|
+
|
|
76
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
ApiResponse, **207** multi-status.
|
|
80
|
+
"""
|
|
81
|
+
media_type = 'application/vnd.dspproposalResource.v' + version + '+json'
|
|
82
|
+
headers = {'Accept': media_type}
|
|
83
|
+
headers['Content-Type'] = media_type
|
|
84
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
85
|
+
return self._request(kwargs.pop('path'),
|
|
86
|
+
data=body, params=kwargs, headers=headers)
|
|
87
|
+
|
|
88
|
+
@sp_endpoint('/dsp/inventory/proposals/buyer/batchTransaction', method='POST',
|
|
89
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
90
|
+
def batch_transaction_proposals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
91
|
+
r"""
|
|
92
|
+
Applies a batch transaction to proposals: accept, reject or counter in bulk.
|
|
93
|
+
|
|
94
|
+
Keyword Args
|
|
95
|
+
|
|
96
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
97
|
+
|
|
98
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
99
|
+
|
|
100
|
+
Returns
|
|
101
|
+
ApiResponse, **207** multi-status.
|
|
102
|
+
"""
|
|
103
|
+
media_type = 'application/vnd.dspproposalResource.v' + version + '+json'
|
|
104
|
+
headers = {'Accept': media_type}
|
|
105
|
+
headers['Content-Type'] = media_type
|
|
106
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
107
|
+
return self._request(kwargs.pop('path'),
|
|
108
|
+
data=body, params=kwargs, headers=headers)
|
|
109
|
+
|
|
110
|
+
@sp_endpoint('/dsp/inventory/proposal/{}/status', method='PUT',
|
|
111
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
112
|
+
def update_proposal_status(self, proposalId, version: str = "1", **kwargs) -> ApiResponse:
|
|
113
|
+
r"""
|
|
114
|
+
Moves a proposal to a new status.
|
|
115
|
+
|
|
116
|
+
Path Parameters
|
|
117
|
+
|
|
118
|
+
- ``proposalId`` (str): the proposal. [required]
|
|
119
|
+
|
|
120
|
+
Keyword Args
|
|
121
|
+
|
|
122
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
123
|
+
|
|
124
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
125
|
+
|
|
126
|
+
Returns
|
|
127
|
+
ApiResponse, ``200``.
|
|
128
|
+
"""
|
|
129
|
+
media_type = 'application/vnd.dspproposalResource.v' + version + '+json'
|
|
130
|
+
headers = {'Accept': media_type}
|
|
131
|
+
headers['Content-Type'] = media_type
|
|
132
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
133
|
+
return self._request(fill_query_params(kwargs.pop('path'), proposalId),
|
|
134
|
+
data=body, params=kwargs, headers=headers)
|
|
135
|
+
|
|
136
|
+
@sp_endpoint('/dsp/inventory/proposalSources/list', method='POST',
|
|
137
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
138
|
+
def list_proposal_sources(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
139
|
+
r"""
|
|
140
|
+
Lists the sources a proposal can come from. Read only.
|
|
141
|
+
|
|
142
|
+
Keyword Args
|
|
143
|
+
|
|
144
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
145
|
+
|
|
146
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
147
|
+
|
|
148
|
+
Returns
|
|
149
|
+
ApiResponse, ``200``, with the sources.
|
|
150
|
+
"""
|
|
151
|
+
media_type = 'application/vnd.dspproposalSourceResource.v' + version + '+json'
|
|
152
|
+
headers = {'Accept': media_type}
|
|
153
|
+
headers['Content-Type'] = media_type
|
|
154
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
155
|
+
return self._request(kwargs.pop('path'),
|
|
156
|
+
data=body, params=kwargs, headers=headers)
|
|
157
|
+
|
|
158
|
+
@sp_endpoint('/dsp/inventory/proposalSource/{}/publishers/list', method='POST',
|
|
159
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
160
|
+
def list_proposal_source_publishers(self, sourceId, version: str = "1", **kwargs) -> ApiResponse:
|
|
161
|
+
r"""
|
|
162
|
+
Lists the publishers of a source. Read only.
|
|
163
|
+
|
|
164
|
+
Keyword Args
|
|
165
|
+
|
|
166
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
167
|
+
|
|
168
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
ApiResponse, ``200``, with the publishers.
|
|
172
|
+
"""
|
|
173
|
+
media_type = 'application/vnd.dspproposalSourceResource.v' + version + '+json'
|
|
174
|
+
headers = {'Accept': media_type}
|
|
175
|
+
headers['Content-Type'] = media_type
|
|
176
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
177
|
+
return self._request(fill_query_params(kwargs.pop('path'), sourceId),
|
|
178
|
+
data=body, params=kwargs, headers=headers)
|
|
179
|
+
|
|
180
|
+
@sp_endpoint('/dsp/inventory/proposalSource/{}/publisherProducts/list', method='POST',
|
|
181
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
182
|
+
def list_proposal_source_products(self, sourceId, version: str = "1", **kwargs) -> ApiResponse:
|
|
183
|
+
r"""
|
|
184
|
+
Lists the publisher products of a source. Read only.
|
|
185
|
+
|
|
186
|
+
Keyword Args
|
|
187
|
+
|
|
188
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
189
|
+
|
|
190
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
191
|
+
|
|
192
|
+
Returns
|
|
193
|
+
ApiResponse, ``200``, with the products.
|
|
194
|
+
"""
|
|
195
|
+
media_type = 'application/vnd.dspproposalSourceResource.v' + version + '+json'
|
|
196
|
+
headers = {'Accept': media_type}
|
|
197
|
+
headers['Content-Type'] = media_type
|
|
198
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
199
|
+
return self._request(fill_query_params(kwargs.pop('path'), sourceId),
|
|
200
|
+
data=body, params=kwargs, headers=headers)
|
|
201
|
+
|
|
202
|
+
@sp_endpoint('/dsp/inventory/proposalSource/{}/publisherOfferings/list', method='POST',
|
|
203
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
204
|
+
def list_proposal_source_offerings(self, sourceId, version: str = "1", **kwargs) -> ApiResponse:
|
|
205
|
+
r"""
|
|
206
|
+
Lists the publisher offerings of a source. Read only.
|
|
207
|
+
|
|
208
|
+
Keyword Args
|
|
209
|
+
|
|
210
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
211
|
+
|
|
212
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
213
|
+
|
|
214
|
+
Returns
|
|
215
|
+
ApiResponse, ``200``, with the offerings.
|
|
216
|
+
"""
|
|
217
|
+
media_type = 'application/vnd.dspproposalSourceResource.v' + version + '+json'
|
|
218
|
+
headers = {'Accept': media_type}
|
|
219
|
+
headers['Content-Type'] = media_type
|
|
220
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
221
|
+
return self._request(fill_query_params(kwargs.pop('path'), sourceId),
|
|
222
|
+
data=body, params=kwargs, headers=headers)
|
|
223
|
+
|
|
224
|
+
@sp_endpoint('/dsp/inventory/proposalSource/{}/publisherProduct/{}/rate', method='POST',
|
|
225
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
226
|
+
def rate_publisher_product(self, sourceId, publisherProductId, version: str = "1", **kwargs) -> ApiResponse:
|
|
227
|
+
r"""
|
|
228
|
+
Reads the rate of a publisher product. Read only despite the POST.
|
|
229
|
+
|
|
230
|
+
Keyword Args
|
|
231
|
+
|
|
232
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
233
|
+
|
|
234
|
+
Returns
|
|
235
|
+
ApiResponse, ``200``, with the rate.
|
|
236
|
+
"""
|
|
237
|
+
media_type = 'application/vnd.dspproposalSourceResource.v' + version + '+json'
|
|
238
|
+
headers = {'Accept': media_type}
|
|
239
|
+
headers['Content-Type'] = media_type
|
|
240
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
241
|
+
return self._request(fill_query_params(kwargs.pop('path'), sourceId, publisherProductId),
|
|
242
|
+
data=body, params=kwargs, headers=headers)
|
|
243
|
+
|
|
244
|
+
@sp_endpoint('/dsp/inventory/proposalSources/amazonMedia/{}/signals/collections/list', method='POST',
|
|
245
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
246
|
+
def list_amazon_media_signal_collections(self, amazonMediaPublisherId, version: str = "1", **kwargs) -> ApiResponse:
|
|
247
|
+
r"""
|
|
248
|
+
Lists the signal collections of an Amazon Media publisher. Read only.
|
|
249
|
+
|
|
250
|
+
Its media type is ``dspsignalCollectionsResource``, not the proposal one.
|
|
251
|
+
|
|
252
|
+
Keyword Args
|
|
253
|
+
|
|
254
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
255
|
+
|
|
256
|
+
Returns
|
|
257
|
+
ApiResponse, ``200``, with the collections.
|
|
258
|
+
"""
|
|
259
|
+
media_type = 'application/vnd.dspsignalCollectionsResource.v' + version + '+json'
|
|
260
|
+
headers = {'Accept': media_type}
|
|
261
|
+
headers['Content-Type'] = media_type
|
|
262
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
263
|
+
return self._request(fill_query_params(kwargs.pop('path'), amazonMediaPublisherId),
|
|
264
|
+
data=body, params=kwargs, headers=headers)
|
|
265
|
+
|
|
266
|
+
@sp_endpoint('/dsp/inventory/proposedDeals/list', method='POST',
|
|
267
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
268
|
+
def list_proposed_deals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
269
|
+
r"""
|
|
270
|
+
Lists proposed deals. Read only.
|
|
271
|
+
|
|
272
|
+
Keyword Args
|
|
273
|
+
|
|
274
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
275
|
+
|
|
276
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
277
|
+
|
|
278
|
+
Returns
|
|
279
|
+
ApiResponse, ``200``, with the deals.
|
|
280
|
+
"""
|
|
281
|
+
media_type = 'application/vnd.dspproposedDealResource.v' + version + '+json'
|
|
282
|
+
headers = {'Accept': media_type}
|
|
283
|
+
headers['Content-Type'] = media_type
|
|
284
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
285
|
+
return self._request(kwargs.pop('path'),
|
|
286
|
+
data=body, params=kwargs, headers=headers)
|
|
287
|
+
|
|
288
|
+
@sp_endpoint('/dsp/inventory/proposedDeals', method='POST',
|
|
289
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
290
|
+
def create_proposed_deals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
291
|
+
r"""
|
|
292
|
+
Creates proposed deals.
|
|
293
|
+
|
|
294
|
+
Keyword Args
|
|
295
|
+
|
|
296
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
297
|
+
|
|
298
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
299
|
+
|
|
300
|
+
Returns
|
|
301
|
+
ApiResponse, **207** multi-status.
|
|
302
|
+
"""
|
|
303
|
+
media_type = 'application/vnd.dspproposedDealResource.v' + version + '+json'
|
|
304
|
+
headers = {'Accept': media_type}
|
|
305
|
+
headers['Content-Type'] = media_type
|
|
306
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
307
|
+
return self._request(kwargs.pop('path'),
|
|
308
|
+
data=body, params=kwargs, headers=headers)
|
|
309
|
+
|
|
310
|
+
@sp_endpoint('/dsp/inventory/proposedDeals', method='PUT',
|
|
311
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
312
|
+
def update_proposed_deals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
313
|
+
r"""
|
|
314
|
+
Updates proposed deals in bulk.
|
|
315
|
+
|
|
316
|
+
Keyword Args
|
|
317
|
+
|
|
318
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
319
|
+
|
|
320
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
321
|
+
|
|
322
|
+
Returns
|
|
323
|
+
ApiResponse, **207** multi-status.
|
|
324
|
+
"""
|
|
325
|
+
media_type = 'application/vnd.dspproposedDealResource.v' + version + '+json'
|
|
326
|
+
headers = {'Accept': media_type}
|
|
327
|
+
headers['Content-Type'] = media_type
|
|
328
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
329
|
+
return self._request(kwargs.pop('path'),
|
|
330
|
+
data=body, params=kwargs, headers=headers)
|
|
331
|
+
|
|
332
|
+
@sp_endpoint('/dsp/inventory/proposedDeals/amazonMedia/calculateImpressions', method='POST',
|
|
333
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
334
|
+
def calculate_deal_impressions(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
335
|
+
r"""
|
|
336
|
+
Estimates the impressions of a proposed deal. Read only.
|
|
337
|
+
|
|
338
|
+
Keyword Args
|
|
339
|
+
|
|
340
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
341
|
+
|
|
342
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
343
|
+
|
|
344
|
+
Returns
|
|
345
|
+
ApiResponse, ``200``, with the impression estimate.
|
|
346
|
+
"""
|
|
347
|
+
media_type = 'application/vnd.dspproposedDealResource.v' + version + '+json'
|
|
348
|
+
headers = {'Accept': media_type}
|
|
349
|
+
headers['Content-Type'] = media_type
|
|
350
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
351
|
+
return self._request(kwargs.pop('path'),
|
|
352
|
+
data=body, params=kwargs, headers=headers)
|
|
353
|
+
|
|
354
|
+
@sp_endpoint('/dsp/inventory/proposedDeals/status', method='PUT',
|
|
355
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
356
|
+
def update_proposed_deal_status(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
357
|
+
r"""
|
|
358
|
+
Moves proposed deals to a new status.
|
|
359
|
+
|
|
360
|
+
Keyword Args
|
|
361
|
+
|
|
362
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
363
|
+
|
|
364
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
365
|
+
|
|
366
|
+
Returns
|
|
367
|
+
ApiResponse, **207** multi-status.
|
|
368
|
+
"""
|
|
369
|
+
media_type = 'application/vnd.dspproposedDealResource.v' + version + '+json'
|
|
370
|
+
headers = {'Accept': media_type}
|
|
371
|
+
headers['Content-Type'] = media_type
|
|
372
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
373
|
+
return self._request(kwargs.pop('path'),
|
|
374
|
+
data=body, params=kwargs, headers=headers)
|
|
375
|
+
|
|
376
|
+
@sp_endpoint('/dsp/inventory/proposedDeals/revisions', method='POST',
|
|
377
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
378
|
+
def create_deal_revisions(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
379
|
+
r"""
|
|
380
|
+
Creates revisions of proposed deals.
|
|
381
|
+
|
|
382
|
+
Keyword Args
|
|
383
|
+
|
|
384
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
385
|
+
|
|
386
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
387
|
+
|
|
388
|
+
Returns
|
|
389
|
+
ApiResponse, **207** multi-status.
|
|
390
|
+
"""
|
|
391
|
+
media_type = 'application/vnd.dspproposedDealResource.v' + version + '+json'
|
|
392
|
+
headers = {'Accept': media_type}
|
|
393
|
+
headers['Content-Type'] = media_type
|
|
394
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
395
|
+
return self._request(kwargs.pop('path'),
|
|
396
|
+
data=body, params=kwargs, headers=headers)
|
|
397
|
+
|
|
398
|
+
@sp_endpoint('/dsp/inventory/proposedDeals/revisions', method='PUT',
|
|
399
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
400
|
+
def update_deal_revisions(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
401
|
+
r"""
|
|
402
|
+
Updates deal revisions.
|
|
403
|
+
|
|
404
|
+
Keyword Args
|
|
405
|
+
|
|
406
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
407
|
+
|
|
408
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
409
|
+
|
|
410
|
+
Returns
|
|
411
|
+
ApiResponse, **207** multi-status.
|
|
412
|
+
"""
|
|
413
|
+
media_type = 'application/vnd.dspproposedDealResource.v' + version + '+json'
|
|
414
|
+
headers = {'Accept': media_type}
|
|
415
|
+
headers['Content-Type'] = media_type
|
|
416
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
417
|
+
return self._request(kwargs.pop('path'),
|
|
418
|
+
data=body, params=kwargs, headers=headers)
|
|
419
|
+
|
|
420
|
+
@sp_endpoint('/dsp/inventory/proposedDeals/revisions/delete', method='POST',
|
|
421
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
422
|
+
def delete_deal_revisions(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
423
|
+
r"""
|
|
424
|
+
Deletes deal revisions. A POST with ``/delete``.
|
|
425
|
+
|
|
426
|
+
Keyword Args
|
|
427
|
+
|
|
428
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
429
|
+
|
|
430
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
431
|
+
|
|
432
|
+
Returns
|
|
433
|
+
ApiResponse, **207** multi-status.
|
|
434
|
+
"""
|
|
435
|
+
media_type = 'application/vnd.dspproposedDealResource.v' + version + '+json'
|
|
436
|
+
headers = {'Accept': media_type}
|
|
437
|
+
headers['Content-Type'] = media_type
|
|
438
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
439
|
+
return self._request(kwargs.pop('path'),
|
|
440
|
+
data=body, params=kwargs, headers=headers)
|
ad_api/api/dsp_deals.py
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"""Deals /dsp/inventory/deals and /dsp/inventorySourceDeals.
|
|
2
|
+
|
|
3
|
+
Contract: Deals 3.0, part of *Deal management*. Eight read routes, plain
|
|
4
|
+
``vnd.deals.v1`` except the last one, which speaks ``vnd.dspinventorysourcedeals``.
|
|
5
|
+
|
|
6
|
+
**All 200: nothing here writes.** Note that ``/dsp/inventorySourceDeals/list``
|
|
7
|
+
has no ``inventory/`` in the middle, unlike its siblings.
|
|
8
|
+
|
|
9
|
+
``ClientId`` is the only required header; ``Scope`` and ``AccountId`` are
|
|
10
|
+
optional. The last route requires all three.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DspDeals(Client):
|
|
17
|
+
r"""Deals - /dsp/inventory/deals
|
|
18
|
+
|
|
19
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/deals-performance-and-exchanges
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@sp_endpoint('/dsp/inventory/deals/list', method='POST',
|
|
23
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
24
|
+
def list_deals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
25
|
+
r"""
|
|
26
|
+
Lists deals. Read only.
|
|
27
|
+
|
|
28
|
+
Keyword Args
|
|
29
|
+
|
|
30
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
31
|
+
|
|
32
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
ApiResponse, ``200``, with the deals.
|
|
36
|
+
"""
|
|
37
|
+
media_type = 'application/vnd.deals.v' + version + '+json'
|
|
38
|
+
headers = {'Accept': media_type}
|
|
39
|
+
headers['Content-Type'] = media_type
|
|
40
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
41
|
+
return self._request(kwargs.pop('path'),
|
|
42
|
+
data=body, params=kwargs, headers=headers)
|
|
43
|
+
|
|
44
|
+
@sp_endpoint('/dsp/inventory/deals/performance/list', method='POST',
|
|
45
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
46
|
+
def list_deal_performance(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
47
|
+
r"""
|
|
48
|
+
Lists deal performance. Read only.
|
|
49
|
+
|
|
50
|
+
Keyword Args
|
|
51
|
+
|
|
52
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
53
|
+
|
|
54
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
ApiResponse, ``200``, with the performance.
|
|
58
|
+
"""
|
|
59
|
+
media_type = 'application/vnd.deals.v' + version + '+json'
|
|
60
|
+
headers = {'Accept': media_type}
|
|
61
|
+
headers['Content-Type'] = media_type
|
|
62
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
63
|
+
return self._request(kwargs.pop('path'),
|
|
64
|
+
data=body, params=kwargs, headers=headers)
|
|
65
|
+
|
|
66
|
+
@sp_endpoint('/dsp/inventory/deals/exchanges/list', method='POST',
|
|
67
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
68
|
+
def list_deal_exchanges(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
69
|
+
r"""
|
|
70
|
+
Lists the exchanges a deal can run on. Read only.
|
|
71
|
+
|
|
72
|
+
Keyword Args
|
|
73
|
+
|
|
74
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
75
|
+
|
|
76
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
ApiResponse, ``200``, with the exchanges.
|
|
80
|
+
"""
|
|
81
|
+
media_type = 'application/vnd.deals.v' + version + '+json'
|
|
82
|
+
headers = {'Accept': media_type}
|
|
83
|
+
headers['Content-Type'] = media_type
|
|
84
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
85
|
+
return self._request(kwargs.pop('path'),
|
|
86
|
+
data=body, params=kwargs, headers=headers)
|
|
87
|
+
|
|
88
|
+
@sp_endpoint('/dsp/inventory/deals/inferredAttributes/list', method='POST',
|
|
89
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
90
|
+
def list_inferred_attributes(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
91
|
+
r"""
|
|
92
|
+
Lists the inferred attributes across deals. Read only.
|
|
93
|
+
|
|
94
|
+
Keyword Args
|
|
95
|
+
|
|
96
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
97
|
+
|
|
98
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
99
|
+
|
|
100
|
+
Returns
|
|
101
|
+
ApiResponse, ``200``, with the attributes.
|
|
102
|
+
"""
|
|
103
|
+
media_type = 'application/vnd.deals.v' + version + '+json'
|
|
104
|
+
headers = {'Accept': media_type}
|
|
105
|
+
headers['Content-Type'] = media_type
|
|
106
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
107
|
+
return self._request(kwargs.pop('path'),
|
|
108
|
+
data=body, params=kwargs, headers=headers)
|
|
109
|
+
|
|
110
|
+
@sp_endpoint('/dsp/inventory/deals/{}/inferredAttributes', method='GET',
|
|
111
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
112
|
+
def get_deal_inferred_attributes(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
113
|
+
r"""
|
|
114
|
+
Reads the inferred attributes of one deal. Read only.
|
|
115
|
+
|
|
116
|
+
Path Parameters
|
|
117
|
+
|
|
118
|
+
- ``dealId`` (str): the deal. [required]
|
|
119
|
+
|
|
120
|
+
Query Params
|
|
121
|
+
|
|
122
|
+
- ``includeMediaTypes``, ``includeDevices``, ``includeLocations``,
|
|
123
|
+
``includeEnvironments``. [optional]
|
|
124
|
+
|
|
125
|
+
Keyword Args
|
|
126
|
+
|
|
127
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
128
|
+
|
|
129
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
130
|
+
|
|
131
|
+
Returns
|
|
132
|
+
ApiResponse, ``200``, with the attributes.
|
|
133
|
+
"""
|
|
134
|
+
media_type = 'application/vnd.deals.v' + version + '+json'
|
|
135
|
+
headers = {'Accept': media_type}
|
|
136
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
137
|
+
params=kwargs, headers=headers)
|
|
138
|
+
|
|
139
|
+
@sp_endpoint('/dsp/inventory/deals/{}/inferredAttributes/supplySellers/list', method='POST',
|
|
140
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
141
|
+
def list_deal_supply_sellers(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
142
|
+
r"""
|
|
143
|
+
Lists the supply sellers of a deal. Read only.
|
|
144
|
+
|
|
145
|
+
Keyword Args
|
|
146
|
+
|
|
147
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
148
|
+
|
|
149
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
150
|
+
|
|
151
|
+
Returns
|
|
152
|
+
ApiResponse, ``200``, with the sellers.
|
|
153
|
+
"""
|
|
154
|
+
media_type = 'application/vnd.deals.v' + version + '+json'
|
|
155
|
+
headers = {'Accept': media_type}
|
|
156
|
+
headers['Content-Type'] = media_type
|
|
157
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
158
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
159
|
+
data=body, params=kwargs, headers=headers)
|
|
160
|
+
|
|
161
|
+
@sp_endpoint('/dsp/inventory/deals/{}/lineItems', method='GET',
|
|
162
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
163
|
+
def list_deal_line_items(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
164
|
+
r"""
|
|
165
|
+
Lists the line items of a deal. Read only.
|
|
166
|
+
|
|
167
|
+
Keyword Args
|
|
168
|
+
|
|
169
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
170
|
+
|
|
171
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
172
|
+
|
|
173
|
+
Returns
|
|
174
|
+
ApiResponse, ``200``, with the line items.
|
|
175
|
+
"""
|
|
176
|
+
media_type = 'application/vnd.deals.v' + version + '+json'
|
|
177
|
+
headers = {'Accept': media_type}
|
|
178
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
179
|
+
params=kwargs, headers=headers)
|
|
180
|
+
|
|
181
|
+
@sp_endpoint('/dsp/inventorySourceDeals/list', method='POST',
|
|
182
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
183
|
+
def list_inventory_source_deals(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
184
|
+
r"""
|
|
185
|
+
Lists the deals of the inventory sources. Read only.
|
|
186
|
+
|
|
187
|
+
This one does not sit under ``/dsp/inventory``, and its media type is
|
|
188
|
+
``dspinventorysourcedeals``, not ``deals``.
|
|
189
|
+
|
|
190
|
+
Keyword Args
|
|
191
|
+
|
|
192
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
193
|
+
|
|
194
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
195
|
+
|
|
196
|
+
Returns
|
|
197
|
+
ApiResponse, ``200``, with the deals.
|
|
198
|
+
"""
|
|
199
|
+
media_type = 'application/vnd.dspinventorysourcedeals.v' + version + '+json'
|
|
200
|
+
headers = {'Accept': media_type}
|
|
201
|
+
headers['Content-Type'] = media_type
|
|
202
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
203
|
+
return self._request(kwargs.pop('path'),
|
|
204
|
+
data=body, params=kwargs, headers=headers)
|