python-amazon-ad-api 2.3.1__py3-none-any.whl → 2.4.1__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 +68 -0
- ad_api/api/dsp_ad_creative_association.py +147 -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_quick_actions.py +177 -0
- ad_api/api/dsp_seats.py +43 -0
- ad_api/api/dsp_seats_management.py +84 -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.1.dist-info}/METADATA +1 -1
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/RECORD +41 -7
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/WHEEL +0 -0
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"""Quick actions /dsp/v1/quickactions.
|
|
2
|
+
|
|
3
|
+
Contract: DSP Quick Actions 3.0, the *Quick actions* entry at the end of the DSP
|
|
4
|
+
tree. Five operations: create executions in bulk, read them in bulk, execute one
|
|
5
|
+
action, read one execution, and start an execution.
|
|
6
|
+
|
|
7
|
+
**Three required headers here, and two of them are unique in this package:**
|
|
8
|
+
|
|
9
|
+
- ``Amazon-Advertising-API-AdvertiserId``
|
|
10
|
+
- ``Amazon-Advertising-API-MarketplaceId``
|
|
11
|
+
|
|
12
|
+
Neither appears in any other DSP family, so they are **not** in the identity
|
|
13
|
+
header set ``sp_endpoint`` knows: they travel as plain headers that the method
|
|
14
|
+
sets itself, taken from the call. ``ClientId`` is required too;
|
|
15
|
+
``Amazon-Ads-AccountId`` is optional.
|
|
16
|
+
|
|
17
|
+
**The media types pair up by request, and the version is ``1.0``:**
|
|
18
|
+
|
|
19
|
+
- ``vnd.dspbatchcreateexecutionsrequest.v1.0`` -> ``...response.v1``
|
|
20
|
+
- ``vnd.dspbatchgetexecutionsrequest.v1.0`` -> ``...response.v1``
|
|
21
|
+
- ``vnd.dspexecution.v1`` on the three single-execution routes
|
|
22
|
+
|
|
23
|
+
Note the asymmetry: the **request** carries ``v1.0`` and the **answer** carries
|
|
24
|
+
``v1``. Both come from the same ``version`` argument, and the ``.0`` is dropped
|
|
25
|
+
on the answer side.
|
|
26
|
+
|
|
27
|
+
Success codes: **207** on the two batch routes, **201** on the execute, ``200``
|
|
28
|
+
on the read and the start.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _identity_headers(kwargs):
|
|
35
|
+
"""The advertiser and marketplace headers, which no other DSP route takes."""
|
|
36
|
+
advertiser = kwargs.pop("advertiserId", None)
|
|
37
|
+
marketplace = kwargs.pop("marketplaceId", None)
|
|
38
|
+
if not advertiser or not marketplace:
|
|
39
|
+
raise ValueError(
|
|
40
|
+
"advertiserId and marketplaceId are required: the contract makes "
|
|
41
|
+
"Amazon-Advertising-API-AdvertiserId and "
|
|
42
|
+
"Amazon-Advertising-API-MarketplaceId mandatory on every route "
|
|
43
|
+
"of this family.")
|
|
44
|
+
return {"Amazon-Advertising-API-AdvertiserId": advertiser,
|
|
45
|
+
"Amazon-Advertising-API-MarketplaceId": marketplace}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class DspQuickActions(Client):
|
|
49
|
+
r"""Quick actions - /dsp/v1/quickactions
|
|
50
|
+
|
|
51
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-quick-actions
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
@sp_endpoint('/dsp/v1/quickactions/batchCreateExecutions', method='POST',
|
|
55
|
+
headers=['Amazon-Ads-AccountId'])
|
|
56
|
+
def batch_create_executions(self, advertiserId, marketplaceId, version: str = "1.0", **kwargs) -> ApiResponse:
|
|
57
|
+
r"""
|
|
58
|
+
Creates executions in bulk.
|
|
59
|
+
|
|
60
|
+
Keyword Args
|
|
61
|
+
|
|
62
|
+
- ``advertiserId`` (str): goes in ``Amazon-Advertising-API-AdvertiserId``. [required]
|
|
63
|
+
- ``marketplaceId`` (str): goes in ``Amazon-Advertising-API-MarketplaceId``. [required]
|
|
64
|
+
- ``version`` (str): version in the media type, ``1.0``. [optional]
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
ApiResponse, **207** multi-status, one per execution.
|
|
68
|
+
"""
|
|
69
|
+
media_type = 'application/vnd.dspbatchcreateexecutionsrequest.v' + version + '+json'
|
|
70
|
+
accept = 'application/vnd.dspbatchcreateexecutionsresponse.v' + version.split('.')[0] + '+json'
|
|
71
|
+
headers = {"Accept": accept, "Content-Type": media_type}
|
|
72
|
+
headers.update(_identity_headers({"advertiserId": advertiserId, "marketplaceId": marketplaceId}))
|
|
73
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
74
|
+
return self._request(kwargs.pop('path'),
|
|
75
|
+
data=body, params=kwargs, headers=headers)
|
|
76
|
+
|
|
77
|
+
@sp_endpoint('/dsp/v1/quickactions/batchGetExecutions', method='POST',
|
|
78
|
+
headers=['Amazon-Ads-AccountId'])
|
|
79
|
+
def batch_get_executions(self, advertiserId, marketplaceId, version: str = "1.0", **kwargs) -> ApiResponse:
|
|
80
|
+
r"""
|
|
81
|
+
Reads executions in bulk.
|
|
82
|
+
|
|
83
|
+
Keyword Args
|
|
84
|
+
|
|
85
|
+
- ``advertiserId`` (str): goes in ``Amazon-Advertising-API-AdvertiserId``. [required]
|
|
86
|
+
- ``marketplaceId`` (str): goes in ``Amazon-Advertising-API-MarketplaceId``. [required]
|
|
87
|
+
- ``version`` (str): version in the media type, ``1.0``. [optional]
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
ApiResponse, **207** multi-status.
|
|
91
|
+
"""
|
|
92
|
+
media_type = 'application/vnd.dspbatchgetexecutionsrequest.v' + version + '+json'
|
|
93
|
+
accept = 'application/vnd.dspbatchgetexecutionsresponse.v' + version.split('.')[0] + '+json'
|
|
94
|
+
headers = {"Accept": accept, "Content-Type": media_type}
|
|
95
|
+
headers.update(_identity_headers({"advertiserId": advertiserId, "marketplaceId": marketplaceId}))
|
|
96
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
97
|
+
return self._request(kwargs.pop('path'),
|
|
98
|
+
data=body, params=kwargs, headers=headers)
|
|
99
|
+
|
|
100
|
+
@sp_endpoint('/dsp/v1/quickactions/{}/executions', method='POST',
|
|
101
|
+
headers=['Amazon-Ads-AccountId'])
|
|
102
|
+
def create_execution(self, actionId, advertiserId, marketplaceId, version: str = "1.0", **kwargs) -> ApiResponse:
|
|
103
|
+
r"""
|
|
104
|
+
Executes one quick action.
|
|
105
|
+
|
|
106
|
+
Path Parameters
|
|
107
|
+
|
|
108
|
+
- ``actionId`` (str): the action. [required]
|
|
109
|
+
|
|
110
|
+
Keyword Args
|
|
111
|
+
|
|
112
|
+
- ``advertiserId`` (str): the advertiser header. [required]
|
|
113
|
+
- ``marketplaceId`` (str): the marketplace header. [required]
|
|
114
|
+
- ``preview`` (str): ``preview`` query, run it without applying. [optional]
|
|
115
|
+
- ``version`` (str): version in the media type, ``1.0``. [optional]
|
|
116
|
+
|
|
117
|
+
Returns
|
|
118
|
+
ApiResponse, **201 created**, with the execution.
|
|
119
|
+
"""
|
|
120
|
+
media_type = 'application/vnd.dspexecution.v' + version.split('.')[0] + '+json'
|
|
121
|
+
headers = {"Accept": media_type, "Content-Type": media_type}
|
|
122
|
+
headers.update(_identity_headers({"advertiserId": advertiserId, "marketplaceId": marketplaceId}))
|
|
123
|
+
return self._request(fill_query_params(kwargs.pop('path'), actionId),
|
|
124
|
+
params=kwargs, headers=headers)
|
|
125
|
+
|
|
126
|
+
@sp_endpoint('/dsp/v1/quickactions/{}/executions/{}', method='GET',
|
|
127
|
+
headers=['Amazon-Ads-AccountId'])
|
|
128
|
+
def get_execution(self, actionId, executionId, advertiserId, marketplaceId, version: str = "1.0", **kwargs) -> ApiResponse:
|
|
129
|
+
r"""
|
|
130
|
+
Reads one execution.
|
|
131
|
+
|
|
132
|
+
Path Parameters
|
|
133
|
+
|
|
134
|
+
- ``actionId`` (str): the action. [required]
|
|
135
|
+
- ``executionId`` (str): the execution. [required]
|
|
136
|
+
|
|
137
|
+
Keyword Args
|
|
138
|
+
|
|
139
|
+
- ``advertiserId`` (str): the advertiser header. [required]
|
|
140
|
+
- ``marketplaceId`` (str): the marketplace header. [required]
|
|
141
|
+
- ``version`` (str): version in the media type, ``1.0``. [optional]
|
|
142
|
+
|
|
143
|
+
Returns
|
|
144
|
+
ApiResponse, ``200``, with the execution.
|
|
145
|
+
"""
|
|
146
|
+
media_type = 'application/vnd.dspexecution.v' + version.split('.')[0] + '+json'
|
|
147
|
+
headers = {"Accept": media_type}
|
|
148
|
+
headers.update(_identity_headers({"advertiserId": advertiserId, "marketplaceId": marketplaceId}))
|
|
149
|
+
return self._request(fill_query_params(kwargs.pop('path'), actionId, executionId),
|
|
150
|
+
params=kwargs, headers=headers)
|
|
151
|
+
|
|
152
|
+
@sp_endpoint('/dsp/v1/quickactions/{}/executions/{}/start', method='PUT',
|
|
153
|
+
headers=['Amazon-Ads-AccountId'])
|
|
154
|
+
def start_execution(self, actionId, executionId, advertiserId, marketplaceId, version: str = "1.0", **kwargs) -> ApiResponse:
|
|
155
|
+
r"""
|
|
156
|
+
Starts an execution that was created in preview mode.
|
|
157
|
+
|
|
158
|
+
Path Parameters
|
|
159
|
+
|
|
160
|
+
- ``actionId`` (str): the action. [required]
|
|
161
|
+
- ``executionId`` (str): the execution. [required]
|
|
162
|
+
|
|
163
|
+
Keyword Args
|
|
164
|
+
|
|
165
|
+
- ``advertiserId`` (str): the advertiser header. [required]
|
|
166
|
+
- ``marketplaceId`` (str): the marketplace header. [required]
|
|
167
|
+
- ``omitStepIds``: steps to skip. [optional]
|
|
168
|
+
- ``version`` (str): version in the media type, ``1.0``. [optional]
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
ApiResponse, ``200``, with the execution.
|
|
172
|
+
"""
|
|
173
|
+
media_type = 'application/vnd.dspexecution.v' + version.split('.')[0] + '+json'
|
|
174
|
+
headers = {"Accept": media_type}
|
|
175
|
+
headers.update(_identity_headers({"advertiserId": advertiserId, "marketplaceId": marketplaceId}))
|
|
176
|
+
return self._request(fill_query_params(kwargs.pop('path'), actionId, executionId),
|
|
177
|
+
params=kwargs, headers=headers)
|
ad_api/api/dsp_seats.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Seats and Seat IDs /dsp/seats.
|
|
2
|
+
|
|
3
|
+
Contract: Seat IDs 3.0, the *Seat IDs* child of *Seats*. One read route,
|
|
4
|
+
``vnd.dspseats``, and two versions: ``v1`` and ``v2``.
|
|
5
|
+
|
|
6
|
+
``ClientId`` is required; ``Scope`` and **``Amazon-Ads-Manager-AccountId``**
|
|
7
|
+
are optional: this is one of the few routes that accepts the manager header,
|
|
8
|
+
and there is no ``Amazon-Ads-AccountId`` at all.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DspSeats(Client):
|
|
15
|
+
r"""Seat IDs - /dsp/seats
|
|
16
|
+
|
|
17
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/seat-ids
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
@sp_endpoint('/dsp/seats/current/list', method='POST',
|
|
21
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Advertising-API-Manager-Account'])
|
|
22
|
+
def list_current_seats(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
23
|
+
r"""
|
|
24
|
+
Lists the seats of the caller. Read only.
|
|
25
|
+
|
|
26
|
+
This is the only route so far that accepts ``Amazon-Ads-Manager-AccountId``
|
|
27
|
+
without an ``Amazon-Ads-AccountId``: the manager replaces the account.
|
|
28
|
+
|
|
29
|
+
Keyword Args
|
|
30
|
+
|
|
31
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
32
|
+
|
|
33
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
34
|
+
|
|
35
|
+
Returns
|
|
36
|
+
ApiResponse, ``200``, with the seats.
|
|
37
|
+
"""
|
|
38
|
+
media_type = 'application/vnd.dspseats.v' + version + '+json'
|
|
39
|
+
headers = {'Accept': media_type}
|
|
40
|
+
headers['Content-Type'] = media_type
|
|
41
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
42
|
+
return self._request(kwargs.pop('path'),
|
|
43
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Seats /dsp/v1/seats.
|
|
2
|
+
|
|
3
|
+
Contract: D16GSeatsApiService 3.0, the *Seats* child of the *Seats* section.
|
|
4
|
+
Three routes, plain ``application/json``: create a seat for an advertiser, list
|
|
5
|
+
the current ones, and reconcile.
|
|
6
|
+
|
|
7
|
+
**The reconcile route is the odd one:** ``POST /v1/seats/reconcile``, with no
|
|
8
|
+
``/dsp`` and no headers declared at all. It is the only route in this package
|
|
9
|
+
with an empty parameter list, so it is the only one declared with
|
|
10
|
+
``headers=[]``.
|
|
11
|
+
|
|
12
|
+
``Amazon-Advertising-API-ClientId`` is the only required header on the other
|
|
13
|
+
two; ``Scope`` and ``AccountId`` are optional.
|
|
14
|
+
|
|
15
|
+
Success codes: **202** on the create, which is accepted and processed later, and
|
|
16
|
+
``200`` on the other two.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class DspSeatsManagement(Client):
|
|
23
|
+
r"""Seats - /dsp/v1/seats
|
|
24
|
+
|
|
25
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-seats
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
@sp_endpoint('/dsp/v1/seats/advertisers/create', method='POST',
|
|
29
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
30
|
+
def create_advertiser_seat(self, **kwargs) -> ApiResponse:
|
|
31
|
+
r"""
|
|
32
|
+
Creates a seat for an advertiser.
|
|
33
|
+
|
|
34
|
+
Keyword Args
|
|
35
|
+
|
|
36
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
ApiResponse, **202 accepted**: the seat is created asynchronously.
|
|
40
|
+
"""
|
|
41
|
+
headers = {'Accept': 'application/json',
|
|
42
|
+
'Content-Type': 'application/json'}
|
|
43
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
44
|
+
return self._request(kwargs.pop('path'),
|
|
45
|
+
data=body, params=kwargs, headers=headers)
|
|
46
|
+
|
|
47
|
+
@sp_endpoint('/dsp/v1/seats/advertisers/current/list', method='POST',
|
|
48
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
49
|
+
def list_current_advertiser_seats(self, **kwargs) -> ApiResponse:
|
|
50
|
+
r"""
|
|
51
|
+
Lists the seats the caller holds right now. Read only, POST because the
|
|
52
|
+
filter goes in the body.
|
|
53
|
+
|
|
54
|
+
Keyword Args
|
|
55
|
+
|
|
56
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
57
|
+
|
|
58
|
+
Returns
|
|
59
|
+
ApiResponse, ``200``, with the seats.
|
|
60
|
+
"""
|
|
61
|
+
headers = {'Accept': 'application/json',
|
|
62
|
+
'Content-Type': 'application/json'}
|
|
63
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
64
|
+
return self._request(kwargs.pop('path'),
|
|
65
|
+
data=body, params=kwargs, headers=headers)
|
|
66
|
+
|
|
67
|
+
@sp_endpoint('/v1/seats/reconcile', method='POST', headers=[])
|
|
68
|
+
def reconcile_seats(self, **kwargs) -> ApiResponse:
|
|
69
|
+
r"""
|
|
70
|
+
Reconciles the seats of the caller.
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
ApiResponse, ``200``.
|
|
74
|
+
|
|
75
|
+
Note
|
|
76
|
+
The contract declares **no parameters at all** for this route: no
|
|
77
|
+
client id, no scope, no account. It is also the only route here
|
|
78
|
+
without ``/dsp`` in the path.
|
|
79
|
+
"""
|
|
80
|
+
headers = {'Accept': 'application/json',
|
|
81
|
+
'Content-Type': 'application/json'}
|
|
82
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
83
|
+
return self._request(kwargs.pop('path'),
|
|
84
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Target KPI recommendations /dsp/campaigns/targetKpi/recommendations.
|
|
2
|
+
|
|
3
|
+
Contract: Goal Seeking Bidder Target KPI Recommendation 3.0. One route, read
|
|
4
|
+
only despite the POST.
|
|
5
|
+
|
|
6
|
+
The two media types do not share a name: the request is
|
|
7
|
+
``vnd.gsbtargetkpirecommendation.v<n>`` and the answer is
|
|
8
|
+
``vnd.spinitialbudgetrecommendation.v<n>``. The released version is 3.4, not 1,
|
|
9
|
+
so that is the default here.
|
|
10
|
+
|
|
11
|
+
Only ``ClientId`` and ``Scope`` are declared: no account id header at all.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DspTargetKpiRecommendations(Client):
|
|
18
|
+
r"""Target KPI recommendations - /dsp/campaigns/targetKpi/recommendations
|
|
19
|
+
|
|
20
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/target-kpi-recommendations
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
@sp_endpoint('/dsp/campaigns/targetKpi/recommendations', method='POST',
|
|
24
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
25
|
+
def get_target_kpi_recommendations(self, version: str = "3.4", **kwargs) -> ApiResponse:
|
|
26
|
+
r"""
|
|
27
|
+
Reads the bid and budget Amazon recommends for a KPI target.
|
|
28
|
+
|
|
29
|
+
The answer arrives as ``vnd.spinitialbudgetrecommendation``, a different name
|
|
30
|
+
from the request. That one is the contract.
|
|
31
|
+
|
|
32
|
+
Keyword Args
|
|
33
|
+
|
|
34
|
+
- ``version`` (str): the version in the media type, ``3.4``. [optional]
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
ApiResponse, ``200``, with the recommendation.
|
|
38
|
+
"""
|
|
39
|
+
media_type = 'application/vnd.gsbtargetkpirecommendation.v' + version + '+json'
|
|
40
|
+
headers = {'Accept': media_type}
|
|
41
|
+
headers['Content-Type'] = media_type
|
|
42
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
43
|
+
return self._request(kwargs.pop('path'),
|
|
44
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Targeting /dsp/v1/targets.
|
|
2
|
+
|
|
3
|
+
Contract: Amazon Ads DSP API Targets - V1 3.0, *Targeting* under *Campaign
|
|
4
|
+
management*. Four operations, all POST, all ``application/json``: create, the
|
|
5
|
+
two deletes, and the read.
|
|
6
|
+
|
|
7
|
+
Here **all three headers are required**, including ``Scope``:
|
|
8
|
+
``Amazon-Advertising-API-ClientId``, ``Amazon-Advertising-API-Scope`` and
|
|
9
|
+
``Amazon-Ads-AccountId``.
|
|
10
|
+
|
|
11
|
+
The create and the two deletes answer 207. ``list`` answers 200.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DspTargeting(Client):
|
|
18
|
+
r"""Targeting - /dsp/v1/targets
|
|
19
|
+
|
|
20
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-universal-targeting
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
@sp_endpoint('/dsp/v1/targets', method='POST',
|
|
24
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
25
|
+
def create_targets(self, **kwargs) -> ApiResponse:
|
|
26
|
+
r"""
|
|
27
|
+
Creates targets on an ad group.
|
|
28
|
+
|
|
29
|
+
Keyword Args
|
|
30
|
+
|
|
31
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
ApiResponse, **207** multi-status, one per target.
|
|
35
|
+
"""
|
|
36
|
+
headers = {'Accept': 'application/json'}
|
|
37
|
+
headers['Content-Type'] = 'application/json'
|
|
38
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
39
|
+
return self._request(kwargs.pop('path'),
|
|
40
|
+
data=body, params=kwargs, headers=headers)
|
|
41
|
+
|
|
42
|
+
@sp_endpoint('/dsp/v1/targets/delete', method='POST',
|
|
43
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
44
|
+
def delete_targets(self, **kwargs) -> ApiResponse:
|
|
45
|
+
r"""
|
|
46
|
+
Deletes targets by id. A POST with ``/delete``: the ids go in the body.
|
|
47
|
+
|
|
48
|
+
Keyword Args
|
|
49
|
+
|
|
50
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
ApiResponse, **207** multi-status.
|
|
54
|
+
"""
|
|
55
|
+
headers = {'Accept': 'application/json'}
|
|
56
|
+
headers['Content-Type'] = 'application/json'
|
|
57
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
58
|
+
return self._request(kwargs.pop('path'),
|
|
59
|
+
data=body, params=kwargs, headers=headers)
|
|
60
|
+
|
|
61
|
+
@sp_endpoint('/dsp/v1/targets/deleteByObject', method='POST',
|
|
62
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
63
|
+
def delete_targets_by_object(self, **kwargs) -> ApiResponse:
|
|
64
|
+
r"""
|
|
65
|
+
Deletes targets by the object they point at, not by id. Use this one when
|
|
66
|
+
what you have is the target expression and not its id.
|
|
67
|
+
|
|
68
|
+
Keyword Args
|
|
69
|
+
|
|
70
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
ApiResponse, **207** multi-status.
|
|
74
|
+
"""
|
|
75
|
+
headers = {'Accept': 'application/json'}
|
|
76
|
+
headers['Content-Type'] = 'application/json'
|
|
77
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
78
|
+
return self._request(kwargs.pop('path'),
|
|
79
|
+
data=body, params=kwargs, headers=headers)
|
|
80
|
+
|
|
81
|
+
@sp_endpoint('/dsp/v1/targets/list', method='POST',
|
|
82
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
83
|
+
def list_targets(self, **kwargs) -> ApiResponse:
|
|
84
|
+
r"""
|
|
85
|
+
Lists targets. Read only, POST because the filter goes in the body.
|
|
86
|
+
|
|
87
|
+
Keyword Args
|
|
88
|
+
|
|
89
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
ApiResponse, ``200``, with the targets.
|
|
93
|
+
"""
|
|
94
|
+
headers = {'Accept': 'application/json'}
|
|
95
|
+
headers['Content-Type'] = 'application/json'
|
|
96
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
97
|
+
return self._request(kwargs.pop('path'),
|
|
98
|
+
data=body, params=kwargs, headers=headers)
|
ad_api/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.
|
|
1
|
+
__version__ = "2.4.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
ad_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
ad_api/version.py,sha256=
|
|
3
|
-
ad_api/api/__init__.py,sha256=
|
|
2
|
+
ad_api/version.py,sha256=LgDSW5laOqA_7i2VW0cZ9QumZREigUxs3ZCBzJ1EG0o,22
|
|
3
|
+
ad_api/api/__init__.py,sha256=FNV0slVKzhqevtT-vHdE7cZCGPXojEb9cQnMlUn2d2k,6057
|
|
4
4
|
ad_api/api/account.py,sha256=jNYwfjW8b0HhqP7PjlMev55aXJP3YIuqWhrxri0Pk4Y,4673
|
|
5
5
|
ad_api/api/account_budgets.py,sha256=jFce5eLWAFK3ydjnYR7_Sv7B0-gHTG5bMTx_TcHyy1A,2319
|
|
6
6
|
ad_api/api/ad_library.py,sha256=nlTMHhqinZF5QKWtXngmwA8reTnG5ChIwQVCs_URUIk,3270
|
|
@@ -16,7 +16,41 @@ ad_api/api/brand_home.py,sha256=IaKKsw2lo5vsmMHs1-tZviHx63t8_cfRFDyWstS-qME,5618
|
|
|
16
16
|
ad_api/api/brand_metrics.py,sha256=zEOSPffq8j-2vAz_z77EcKU2sa9i1WzzBqswTmoL5yA,9321
|
|
17
17
|
ad_api/api/campaign_diagnostics.py,sha256=3yoAhaHzYgoPqJ3aA88DVyI6-4VECUxy1KEkoMkqRhM,2508
|
|
18
18
|
ad_api/api/creative_assets.py,sha256=u0bCnioUFpGOQO5Z_MO0ErSLcAgSZB5GWM5wm2oW6L0,9687
|
|
19
|
+
ad_api/api/dsp_ad_creative_association.py,sha256=u0hvFlLCLYfmgEMCqhzxlqH9SJhH4ZC96KuRX7ZSJ0c,6481
|
|
20
|
+
ad_api/api/dsp_ad_group_and_campaign.py,sha256=fbV2IhEQSGX30Srxd7lGa0eQBYUogzrv9iW7Q47UDFs,5452
|
|
19
21
|
ad_api/api/dsp_advertiser.py,sha256=ztSr0s15Z9scQNKElWxRujexsENn84MT-ihNhijLi_M,1427
|
|
22
|
+
ad_api/api/dsp_audience_create.py,sha256=IB8iFeVDt7gjtJ5N2YumDgmArS-IZMFWXPLtR-nd5-Q,2026
|
|
23
|
+
ad_api/api/dsp_bid_adjustments.py,sha256=A3o_cXQ4YGyueVMNw6EP_CxICcLEnwb1L5wTtsVTpvk,7526
|
|
24
|
+
ad_api/api/dsp_campaign_flights.py,sha256=pHSASscr3VcFX0iWCUIqv1g1sSAmf2ixfYSknJF7g-g,4408
|
|
25
|
+
ad_api/api/dsp_campaign_insights.py,sha256=ZeHy6vhhJTd9EeKshnGobM6W2tk2xTDY24LotyKWTTE,2675
|
|
26
|
+
ad_api/api/dsp_combined_audiences.py,sha256=yjvEXI8u3rCH1kaZQfeZS2FYU8iqlo7tIuGT3IL7Gpo,3279
|
|
27
|
+
ad_api/api/dsp_conversion_tracking_products.py,sha256=cZOv8ol5nd58PZnVLHG1srpOgFCBFSLr9M277S4XNek,3584
|
|
28
|
+
ad_api/api/dsp_conversions.py,sha256=eKwqnkZJcCQPsEckzsBSgUIx1rLZHYyWLpu7B_S6EX0,19745
|
|
29
|
+
ad_api/api/dsp_creatives.py,sha256=QFLtTGaFNKWWn7--rJnn35QOdrOMxY0zuLBsJFux9Qc,3979
|
|
30
|
+
ad_api/api/dsp_deal_permissions.py,sha256=LI3NZhZO9_3KUGkkziBGCJJf63FbztmAomaOqfHbXRs,7176
|
|
31
|
+
ad_api/api/dsp_deal_proposals.py,sha256=_4FVHISvENFMMaVQl0HjtK9hm9Ypd30Ph9gvd6Rgsz0,18466
|
|
32
|
+
ad_api/api/dsp_deals.py,sha256=R6iJm-UKKjpVW4DOADLdf0y-CIkufEW941-2z_ksFGw,8183
|
|
33
|
+
ad_api/api/dsp_deals_management.py,sha256=6CSCfQdxIjx-IZM9qaG_scaElMVVyFnXqwGv_SnqnO4,2520
|
|
34
|
+
ad_api/api/dsp_discovery_advertised_product_categories.py,sha256=o3QY7be1OJD4_XV2qV1fLMWKajf_X_bDkVBzVMe0AOM,1353
|
|
35
|
+
ad_api/api/dsp_discovery_apps.py,sha256=fDCaKpTRBA0KUw8SLfme4McGS42OZ3oxfIznDvrJtXU,1216
|
|
36
|
+
ad_api/api/dsp_discovery_domain_lists.py,sha256=631ROR-ADIfflVtqJawdGNcA464_xflJaN87ljHBt7Y,1251
|
|
37
|
+
ad_api/api/dsp_discovery_geo_locations.py,sha256=XTNksxhEQ9WzNtqgta68NxpirM9D0-6lsojKXBXnnHU,1411
|
|
38
|
+
ad_api/api/dsp_discovery_iab_content.py,sha256=9eIZzcIiHB_sR2pJBYBTTKAVMqtYZOH3Wnb1s3Rtrtg,1474
|
|
39
|
+
ad_api/api/dsp_discovery_inventory_source_exchanges.py,sha256=w6G32Z8PYMoFPNTJrKEVMjKKvGE0a2ClpRi_g2eH7to,1369
|
|
40
|
+
ad_api/api/dsp_discovery_products.py,sha256=Cn0FdDwjmYuvbyU4BpRx8s9I7zQQZzuCCtihRw-1rbE,4180
|
|
41
|
+
ad_api/api/dsp_discovery_third_party_target_segments.py,sha256=zleUbD2pGH8ASlL4xrd6iUMviECejQzCp1JSLIyWOCw,1363
|
|
42
|
+
ad_api/api/dsp_frequency_associations.py,sha256=v7WzFgRT_RG-u8tV6eKhYqn7ONkZkL6gRSQnic8_J8k,5641
|
|
43
|
+
ad_api/api/dsp_frequency_groups.py,sha256=oTIotgyeTkq0JxFpZBP_PnneQs4taxutwpwC1xRjP2U,4460
|
|
44
|
+
ad_api/api/dsp_frequency_insights.py,sha256=_K0fwhNUu6xq1N3euQcPXrcB5J6Gy2FQaCFsFxDKHW4,3617
|
|
45
|
+
ad_api/api/dsp_guidance.py,sha256=k2zi1oBENL-B1fNpNVRXfqcL1nzsHpELzgD_96L9vt4,5096
|
|
46
|
+
ad_api/api/dsp_inherited_settings.py,sha256=iOioqjWs_KrbelZoOFL_b4oQugCTB-5xN3l5UmtD4SQ,5046
|
|
47
|
+
ad_api/api/dsp_inventory_groups.py,sha256=0Hapif-8X8bWrOlgcGpYIG9vZjEzy62TOWbSlPfubQo,8288
|
|
48
|
+
ad_api/api/dsp_measurement.py,sha256=nIoJVggWBx1jiQR6U7v6V5dDOqBKIsbma9NRULszQUc,29862
|
|
49
|
+
ad_api/api/dsp_quick_actions.py,sha256=Aw1ci4iqBJi_5sfq4iBePv3PuCBC_oNl8EAxx88R3dk,8123
|
|
50
|
+
ad_api/api/dsp_seats.py,sha256=eCOn-KmLHbuRs2jqgCJKu7bsXtVX38-rEkSyUZE5iDk,1655
|
|
51
|
+
ad_api/api/dsp_seats_management.py,sha256=h1NW1eeB4S3giL94_KIUXghz_DZsYt_OFM7NkMx_8UE,3244
|
|
52
|
+
ad_api/api/dsp_target_kpi_recommendations.py,sha256=PLjrmxxSs5wJ9yWs_Q0Pqu1ZBiam1wtAPlhSkY3pCyE,1782
|
|
53
|
+
ad_api/api/dsp_targeting.py,sha256=CTR8cns9f3u8sa9r-N4ObR5Yl7duhqQMd6XbGfbx7pM,3733
|
|
20
54
|
ad_api/api/eligibility.py,sha256=3hKloUciUZ4CplJkaHvrteUEuhv37-sVrQUYnfIMuZU,3824
|
|
21
55
|
ad_api/api/exports.py,sha256=nHUIn-iQKAL5XS2IW5xwYs8ZbHmk1rutpmfPz7O2UvY,7968
|
|
22
56
|
ad_api/api/forecast.py,sha256=EwEb71lK7xPEmxzvw-_-VqRx6ZQ73vwX8xYjL6IP5Oc,5582
|
|
@@ -161,8 +195,8 @@ ad_api/base/marketplaces.py,sha256=44lvCcluXNpqTprWQ80e3weSQmQbJoWL-WDSOWVbCyQ,4
|
|
|
161
195
|
ad_api/base/utils.py,sha256=_qnCBOvyJTLgaZjJzUWTi38GGLHkQszXELs79133Rb4,5618
|
|
162
196
|
ad_api/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
163
197
|
ad_api/shared/base_client.py,sha256=zOL_LTh-58URWf3ZDlrwmqXXbd6PX66QF5hrr2p83yY,356
|
|
164
|
-
python_amazon_ad_api-2.
|
|
165
|
-
python_amazon_ad_api-2.
|
|
166
|
-
python_amazon_ad_api-2.
|
|
167
|
-
python_amazon_ad_api-2.
|
|
168
|
-
python_amazon_ad_api-2.
|
|
198
|
+
python_amazon_ad_api-2.4.1.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
|
|
199
|
+
python_amazon_ad_api-2.4.1.dist-info/METADATA,sha256=G2ot0iCPBRuUiQe5dxNO3-B1_ui02UpSyhB11pNp-Tw,10678
|
|
200
|
+
python_amazon_ad_api-2.4.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
201
|
+
python_amazon_ad_api-2.4.1.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
|
|
202
|
+
python_amazon_ad_api-2.4.1.dist-info/RECORD,,
|
|
File without changes
|
{python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|