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,114 @@
|
|
|
1
|
+
"""Creative management /sd/creatives.
|
|
2
|
+
|
|
3
|
+
Contract: Creative Management 3.0, the *Creative management* entry of Amazon DSP.
|
|
4
|
+
Five operations over five paths, all plain ``application/json``: no version.
|
|
5
|
+
|
|
6
|
+
**The paths are ``/sd/creatives``**, not ``/dsp/``: the contract reuses the
|
|
7
|
+
Sponsored Display resource, so a URL check here must look at the verb and the
|
|
8
|
+
path, not at the product name.
|
|
9
|
+
|
|
10
|
+
Only ``ClientId`` and ``Scope`` are declared. There is no account id header, and
|
|
11
|
+
``Scope`` is required.
|
|
12
|
+
|
|
13
|
+
207 on the create and the update; 200 on the two reads and the preview.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DspCreatives(Client):
|
|
20
|
+
r"""Creative management - /sd/creatives
|
|
21
|
+
|
|
22
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-ad-creative
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
@sp_endpoint('/sd/creatives', method='GET',
|
|
26
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
27
|
+
def list_creatives(self, **kwargs) -> ApiResponse:
|
|
28
|
+
r"""
|
|
29
|
+
Lists the creatives of the account. Read only.
|
|
30
|
+
|
|
31
|
+
Query Params
|
|
32
|
+
|
|
33
|
+
- ``startIndex``, ``count``, ``adGroupIdFilter``, ``creativeIdFilter``,
|
|
34
|
+
``moderationStatusFilter``. [optional]
|
|
35
|
+
|
|
36
|
+
Keyword Args
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
ApiResponse, ``200``, with the creatives.
|
|
40
|
+
"""
|
|
41
|
+
headers = {'Accept': 'application/json'}
|
|
42
|
+
return self._request(kwargs.pop('path'),
|
|
43
|
+
params=kwargs, headers=headers)
|
|
44
|
+
|
|
45
|
+
@sp_endpoint('/sd/creatives', method='POST',
|
|
46
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
47
|
+
def create_creatives(self, **kwargs) -> ApiResponse:
|
|
48
|
+
r"""
|
|
49
|
+
Creates creatives.
|
|
50
|
+
|
|
51
|
+
Keyword Args
|
|
52
|
+
|
|
53
|
+
Returns
|
|
54
|
+
ApiResponse, **207** multi-status, one per creative.
|
|
55
|
+
"""
|
|
56
|
+
headers = {'Accept': 'application/json'}
|
|
57
|
+
headers['Content-Type'] = 'application/json'
|
|
58
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
59
|
+
return self._request(kwargs.pop('path'),
|
|
60
|
+
data=body, params=kwargs, headers=headers)
|
|
61
|
+
|
|
62
|
+
@sp_endpoint('/sd/creatives', method='PUT',
|
|
63
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
64
|
+
def update_creatives(self, **kwargs) -> ApiResponse:
|
|
65
|
+
r"""
|
|
66
|
+
Updates creatives in bulk.
|
|
67
|
+
|
|
68
|
+
Keyword Args
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
ApiResponse, **207** multi-status.
|
|
72
|
+
"""
|
|
73
|
+
headers = {'Accept': 'application/json'}
|
|
74
|
+
headers['Content-Type'] = 'application/json'
|
|
75
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
76
|
+
return self._request(kwargs.pop('path'),
|
|
77
|
+
data=body, params=kwargs, headers=headers)
|
|
78
|
+
|
|
79
|
+
@sp_endpoint('/sd/creatives/preview', method='POST',
|
|
80
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
81
|
+
def preview_creative(self, **kwargs) -> ApiResponse:
|
|
82
|
+
r"""
|
|
83
|
+
Renders a preview of a creative.
|
|
84
|
+
|
|
85
|
+
Keyword Args
|
|
86
|
+
|
|
87
|
+
Returns
|
|
88
|
+
ApiResponse, ``200``, with the preview.
|
|
89
|
+
"""
|
|
90
|
+
headers = {'Accept': 'application/json'}
|
|
91
|
+
headers['Content-Type'] = 'application/json'
|
|
92
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
93
|
+
return self._request(kwargs.pop('path'),
|
|
94
|
+
data=body, params=kwargs, headers=headers)
|
|
95
|
+
|
|
96
|
+
@sp_endpoint('/sd/moderation/creatives', method='GET',
|
|
97
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
98
|
+
def list_moderation_creatives(self, **kwargs) -> ApiResponse:
|
|
99
|
+
r"""
|
|
100
|
+
Lists the creatives with their moderation status. Read only.
|
|
101
|
+
|
|
102
|
+
Query Params
|
|
103
|
+
|
|
104
|
+
- ``language``: **required**. [required]
|
|
105
|
+
- ``startIndex``, ``count``, ``adGroupIdFilter``, ``creativeIdFilter``. [optional]
|
|
106
|
+
|
|
107
|
+
Keyword Args
|
|
108
|
+
|
|
109
|
+
Returns
|
|
110
|
+
ApiResponse, ``200``, with the moderation status.
|
|
111
|
+
"""
|
|
112
|
+
headers = {'Accept': 'application/json'}
|
|
113
|
+
return self._request(kwargs.pop('path'),
|
|
114
|
+
params=kwargs, headers=headers)
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"""Deal advertiser permissions /dsp/inventory/deals/{dealId}/advertiserPermissions.
|
|
2
|
+
|
|
3
|
+
Contract: Deal Advertiser Permissions 3.0. Eight operations over seven paths,
|
|
4
|
+
all scoped to one deal.
|
|
5
|
+
|
|
6
|
+
**Four success codes:** ``201`` on the create, ``207`` on the two bulk writes,
|
|
7
|
+
``200`` on the reads, and ``200`` **with no body** on the two DELETEs.
|
|
8
|
+
|
|
9
|
+
``ClientId`` and ``Scope`` are required, and **there is no account id header**.
|
|
10
|
+
The media types have capital letters: ``dspDealAdvertiserPermissionsResource``.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DspDealAdvertiserPermissions(Client):
|
|
17
|
+
r"""Deal advertiser permissions - /dsp/inventory/deals/{dealId}/advertiserPermissions
|
|
18
|
+
|
|
19
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/deal-advertiser-permissions
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@sp_endpoint('/dsp/inventory/deals/{}/advertiserPermissions', method='GET',
|
|
23
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
24
|
+
def get_permissions(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
25
|
+
r"""
|
|
26
|
+
Reads the advertiser permissions of a deal. Read only.
|
|
27
|
+
|
|
28
|
+
Keyword Args
|
|
29
|
+
|
|
30
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
ApiResponse, ``200``, with the permissions.
|
|
34
|
+
"""
|
|
35
|
+
media_type = 'application/vnd.dspDealAdvertiserPermissionsResource.v' + version + '+json'
|
|
36
|
+
headers = {'Accept': media_type}
|
|
37
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
38
|
+
params=kwargs, headers=headers)
|
|
39
|
+
|
|
40
|
+
@sp_endpoint('/dsp/inventory/deals/{}/advertiserPermissions', method='POST',
|
|
41
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
42
|
+
def create_permissions(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
43
|
+
r"""
|
|
44
|
+
Grants advertiser permissions on a deal. Answers 201 with no body.
|
|
45
|
+
|
|
46
|
+
Keyword Args
|
|
47
|
+
|
|
48
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
ApiResponse, **201 created**, with **no body**.
|
|
52
|
+
"""
|
|
53
|
+
media_type = 'application/vnd.dspDealAdvertiserPermissionsResource.v' + version + '+json'
|
|
54
|
+
headers = {'Accept': media_type}
|
|
55
|
+
headers['Content-Type'] = media_type
|
|
56
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
57
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
58
|
+
data=body, params=kwargs, headers=headers)
|
|
59
|
+
|
|
60
|
+
@sp_endpoint('/dsp/inventory/deals/{}/advertiserPermissions', method='DELETE',
|
|
61
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
62
|
+
def delete_permissions(self, dealId, **kwargs) -> ApiResponse:
|
|
63
|
+
r"""
|
|
64
|
+
Removes the advertiser permissions of a deal.
|
|
65
|
+
|
|
66
|
+
Keyword Args
|
|
67
|
+
|
|
68
|
+
Returns
|
|
69
|
+
ApiResponse, ``200``, with **no body**.
|
|
70
|
+
"""
|
|
71
|
+
headers = {'Accept': 'application/json'}
|
|
72
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
73
|
+
params=kwargs, headers=headers)
|
|
74
|
+
|
|
75
|
+
@sp_endpoint('/dsp/inventory/deals/{}/advertiserPermissions/advertiserList', method='GET',
|
|
76
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
77
|
+
def list_deal_advertisers(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
78
|
+
r"""
|
|
79
|
+
Lists the advertisers permitted on a deal. Read only.
|
|
80
|
+
|
|
81
|
+
Query Params
|
|
82
|
+
|
|
83
|
+
- ``pageSize``, ``nextToken``. [optional]
|
|
84
|
+
|
|
85
|
+
Keyword Args
|
|
86
|
+
|
|
87
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
ApiResponse, ``200``, with the advertisers.
|
|
91
|
+
"""
|
|
92
|
+
media_type = 'application/vnd.dspAdvertiserListResource.v' + version + '+json'
|
|
93
|
+
headers = {'Accept': media_type}
|
|
94
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
95
|
+
params=kwargs, headers=headers)
|
|
96
|
+
|
|
97
|
+
@sp_endpoint('/dsp/inventory/deals/{}/advertiserPermissions/advertiserList', method='PUT',
|
|
98
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
99
|
+
def update_deal_advertisers(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
100
|
+
r"""
|
|
101
|
+
Replaces the advertiser list of a deal.
|
|
102
|
+
|
|
103
|
+
Keyword Args
|
|
104
|
+
|
|
105
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
106
|
+
|
|
107
|
+
Returns
|
|
108
|
+
ApiResponse, **207** multi-status.
|
|
109
|
+
"""
|
|
110
|
+
media_type = 'application/vnd.dspAdvertiserListResource.v' + version + '+json'
|
|
111
|
+
headers = {'Accept': media_type}
|
|
112
|
+
headers['Content-Type'] = media_type
|
|
113
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
114
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
115
|
+
data=body, params=kwargs, headers=headers)
|
|
116
|
+
|
|
117
|
+
@sp_endpoint('/dsp/inventory/deals/{}/advertiserPermissions/recommendedAdvertiser/list', method='POST',
|
|
118
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
119
|
+
def list_recommended_advertisers(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
120
|
+
r"""
|
|
121
|
+
Lists the advertisers Amazon recommends for a deal. Read only.
|
|
122
|
+
|
|
123
|
+
Keyword Args
|
|
124
|
+
|
|
125
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
126
|
+
|
|
127
|
+
Returns
|
|
128
|
+
ApiResponse, ``200``, with the recommendations.
|
|
129
|
+
"""
|
|
130
|
+
media_type = 'application/vnd.dspDealRecommendedAdvertiser.v' + version + '+json'
|
|
131
|
+
headers = {'Accept': media_type}
|
|
132
|
+
headers['Content-Type'] = media_type
|
|
133
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
134
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
135
|
+
data=body, params=kwargs, headers=headers)
|
|
136
|
+
|
|
137
|
+
@sp_endpoint('/dsp/inventory/deals/{}/advertiserPermissions/recommendedAdvertisers', method='PUT',
|
|
138
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
139
|
+
def update_recommended_advertisers(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
140
|
+
r"""
|
|
141
|
+
Applies recommended advertisers to a deal.
|
|
142
|
+
|
|
143
|
+
Keyword Args
|
|
144
|
+
|
|
145
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
146
|
+
|
|
147
|
+
Returns
|
|
148
|
+
ApiResponse, **207** multi-status.
|
|
149
|
+
"""
|
|
150
|
+
media_type = 'application/vnd.dspDealRecommendedAdvertiser.v' + version + '+json'
|
|
151
|
+
headers = {'Accept': media_type}
|
|
152
|
+
headers['Content-Type'] = media_type
|
|
153
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
154
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
155
|
+
data=body, params=kwargs, headers=headers)
|
|
156
|
+
|
|
157
|
+
@sp_endpoint('/dsp/inventory/deals/{}/advertiserPermissions/recommendedAdvertisers', method='DELETE',
|
|
158
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
159
|
+
def delete_recommended_advertisers(self, dealId, **kwargs) -> ApiResponse:
|
|
160
|
+
r"""
|
|
161
|
+
Clears the recommended advertisers of a deal.
|
|
162
|
+
|
|
163
|
+
Keyword Args
|
|
164
|
+
|
|
165
|
+
Returns
|
|
166
|
+
ApiResponse, ``200``, with **no body**.
|
|
167
|
+
"""
|
|
168
|
+
headers = {'Accept': 'application/json'}
|
|
169
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
170
|
+
params=kwargs, headers=headers)
|