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,209 @@
|
|
|
1
|
+
"""Inventory groups /dsp/inventory.
|
|
2
|
+
|
|
3
|
+
Contract: Inventory Groups 3.0. Nine operations over eight paths, and **two
|
|
4
|
+
generations living side by side**:
|
|
5
|
+
|
|
6
|
+
- ``/dsp/inventory/packages`` speaks ``vnd.supplypackages``.
|
|
7
|
+
- ``/dsp/v1/inventory/inventoryGroups`` speaks plain ``application/json``.
|
|
8
|
+
|
|
9
|
+
The second family is the newer one and carries the ``v1`` in the path, so no
|
|
10
|
+
``version`` argument is needed: the generation is in the URL.
|
|
11
|
+
|
|
12
|
+
Also ``201`` on the package create, ``204`` on its update, ``201`` on the group
|
|
13
|
+
create and ``204`` on the group update.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DspInventoryGroups(Client):
|
|
20
|
+
r"""Inventory groups - /dsp/inventory
|
|
21
|
+
|
|
22
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/inventory-groups
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
@sp_endpoint('/dsp/inventory/packages', method='POST',
|
|
26
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
27
|
+
def create_package(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
28
|
+
r"""
|
|
29
|
+
Creates a supply package.
|
|
30
|
+
|
|
31
|
+
Keyword Args
|
|
32
|
+
|
|
33
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
34
|
+
|
|
35
|
+
Returns
|
|
36
|
+
ApiResponse, **201 created**.
|
|
37
|
+
"""
|
|
38
|
+
media_type = 'application/vnd.supplypackages.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)
|
|
44
|
+
|
|
45
|
+
@sp_endpoint('/dsp/inventory/packages/list', method='POST',
|
|
46
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
47
|
+
def list_packages(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
48
|
+
r"""
|
|
49
|
+
Lists supply packages. Read only.
|
|
50
|
+
|
|
51
|
+
Keyword Args
|
|
52
|
+
|
|
53
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
ApiResponse, ``200``, with the packages.
|
|
57
|
+
"""
|
|
58
|
+
media_type = 'application/vnd.supplypackages.v' + version + '+json'
|
|
59
|
+
headers = {'Accept': media_type}
|
|
60
|
+
headers['Content-Type'] = media_type
|
|
61
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
62
|
+
return self._request(kwargs.pop('path'),
|
|
63
|
+
data=body, params=kwargs, headers=headers)
|
|
64
|
+
|
|
65
|
+
@sp_endpoint('/dsp/inventory/packages/{}', method='PUT',
|
|
66
|
+
headers=['Amazon-Advertising-API-Scope'])
|
|
67
|
+
def update_package(self, supplyPackageId, version: str = "1", **kwargs) -> ApiResponse:
|
|
68
|
+
r"""
|
|
69
|
+
Updates a supply package.
|
|
70
|
+
|
|
71
|
+
Keyword Args
|
|
72
|
+
|
|
73
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
74
|
+
|
|
75
|
+
Returns
|
|
76
|
+
ApiResponse, **204**, with **no body**.
|
|
77
|
+
"""
|
|
78
|
+
media_type = 'application/vnd.supplypackages.v' + version + '+json'
|
|
79
|
+
headers = {'Accept': media_type}
|
|
80
|
+
headers['Content-Type'] = media_type
|
|
81
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
82
|
+
return self._request(fill_query_params(kwargs.pop('path'), supplyPackageId),
|
|
83
|
+
data=body, params=kwargs, headers=headers)
|
|
84
|
+
|
|
85
|
+
@sp_endpoint('/dsp/inventorySourceInventoryGroups/list', method='POST',
|
|
86
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
87
|
+
def list_inventory_source_groups(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
88
|
+
r"""
|
|
89
|
+
Lists the inventory groups of the inventory sources. Read only.
|
|
90
|
+
|
|
91
|
+
The request speaks ``vnd.inventorydiscoveryinventorygroups`` and **the answer
|
|
92
|
+
speaks ``vnd.supplypackages``**: two names.
|
|
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 groups. The answer is ``supplypackages``.
|
|
102
|
+
"""
|
|
103
|
+
media_type = 'application/vnd.inventorydiscoveryinventorygroups.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/v1/inventory/eligibility/inventoryGroups/list', method='POST',
|
|
111
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
112
|
+
def list_eligible_inventory_groups(self, **kwargs) -> ApiResponse:
|
|
113
|
+
r"""
|
|
114
|
+
Lists the inventory groups an advertiser is eligible for. Read only.
|
|
115
|
+
|
|
116
|
+
Plain ``application/json``; no ``vnd`` here.
|
|
117
|
+
|
|
118
|
+
Keyword Args
|
|
119
|
+
|
|
120
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
121
|
+
|
|
122
|
+
Returns
|
|
123
|
+
ApiResponse, ``200``, with the eligibility.
|
|
124
|
+
"""
|
|
125
|
+
headers = {'Accept': 'application/json'}
|
|
126
|
+
headers['Content-Type'] = 'application/json'
|
|
127
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
128
|
+
return self._request(kwargs.pop('path'),
|
|
129
|
+
data=body, params=kwargs, headers=headers)
|
|
130
|
+
|
|
131
|
+
@sp_endpoint('/dsp/v1/inventory/inventoryGroups', method='POST',
|
|
132
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
133
|
+
def create_inventory_group(self, **kwargs) -> ApiResponse:
|
|
134
|
+
r"""
|
|
135
|
+
Creates an inventory group.
|
|
136
|
+
|
|
137
|
+
Keyword Args
|
|
138
|
+
|
|
139
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
140
|
+
|
|
141
|
+
Returns
|
|
142
|
+
ApiResponse, **201 created**.
|
|
143
|
+
"""
|
|
144
|
+
headers = {'Accept': 'application/json'}
|
|
145
|
+
headers['Content-Type'] = 'application/json'
|
|
146
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
147
|
+
return self._request(kwargs.pop('path'),
|
|
148
|
+
data=body, params=kwargs, headers=headers)
|
|
149
|
+
|
|
150
|
+
@sp_endpoint('/dsp/v1/inventory/inventoryGroups', method='PUT',
|
|
151
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
152
|
+
def update_inventory_group(self, **kwargs) -> ApiResponse:
|
|
153
|
+
r"""
|
|
154
|
+
Updates an inventory group. The id goes in the body, not in the path.
|
|
155
|
+
|
|
156
|
+
Keyword Args
|
|
157
|
+
|
|
158
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
159
|
+
|
|
160
|
+
Returns
|
|
161
|
+
ApiResponse, **204**, with **no body**.
|
|
162
|
+
"""
|
|
163
|
+
headers = {'Accept': 'application/json'}
|
|
164
|
+
headers['Content-Type'] = 'application/json'
|
|
165
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
166
|
+
return self._request(kwargs.pop('path'),
|
|
167
|
+
data=body, params=kwargs, headers=headers)
|
|
168
|
+
|
|
169
|
+
@sp_endpoint('/dsp/v1/inventory/inventoryGroups/list', method='POST',
|
|
170
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
171
|
+
def list_inventory_groups(self, **kwargs) -> ApiResponse:
|
|
172
|
+
r"""
|
|
173
|
+
Lists inventory groups. Read only.
|
|
174
|
+
|
|
175
|
+
Keyword Args
|
|
176
|
+
|
|
177
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
178
|
+
|
|
179
|
+
Returns
|
|
180
|
+
ApiResponse, ``200``, with the groups.
|
|
181
|
+
"""
|
|
182
|
+
headers = {'Accept': 'application/json'}
|
|
183
|
+
headers['Content-Type'] = 'application/json'
|
|
184
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
185
|
+
return self._request(kwargs.pop('path'),
|
|
186
|
+
data=body, params=kwargs, headers=headers)
|
|
187
|
+
|
|
188
|
+
@sp_endpoint('/dsp/v1/inventory/inventoryGroups/{}/adgroups/list', method='POST',
|
|
189
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
190
|
+
def list_inventory_group_ad_groups(self, inventoryGroupId, **kwargs) -> ApiResponse:
|
|
191
|
+
r"""
|
|
192
|
+
Lists the ad groups of an inventory group. Read only.
|
|
193
|
+
|
|
194
|
+
Path Parameters
|
|
195
|
+
|
|
196
|
+
- ``inventoryGroupId`` (str): the group. [required]
|
|
197
|
+
|
|
198
|
+
Keyword Args
|
|
199
|
+
|
|
200
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
ApiResponse, ``200``, with the ad groups.
|
|
204
|
+
"""
|
|
205
|
+
headers = {'Accept': 'application/json'}
|
|
206
|
+
headers['Content-Type'] = 'application/json'
|
|
207
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
208
|
+
return self._request(fill_query_params(kwargs.pop('path'), inventoryGroupId),
|
|
209
|
+
data=body, params=kwargs, headers=headers)
|