python-amazon-ad-api 2.3.0__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 +76 -0
- ad_api/api/campaign_diagnostics.py +1 -1
- 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/api/forecast.py +130 -0
- ad_api/api/hashed_records.py +39 -0
- ad_api/api/historic_reach.py +148 -0
- ad_api/api/locations.py +57 -0
- ad_api/api/plan_management.py +1268 -0
- ad_api/api/record_management.py +121 -0
- ad_api/api/targetable_entities.py +89 -0
- ad_api/version.py +1 -1
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/METADATA +1 -1
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/RECORD +46 -8
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/WHEEL +0 -0
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_ad_api-2.3.0.dist-info → python_amazon_ad_api-2.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Deals management /dsp/inventory/deals.
|
|
2
|
+
|
|
3
|
+
Contract: D16GDspApiDeals 3.0, the *Deals management* child of *Deal management*:
|
|
4
|
+
the two routes that write a deal. **Not the same contract as *Deals performance
|
|
5
|
+
and exchanges***, which is a different family with eight read routes.
|
|
6
|
+
|
|
7
|
+
``vnd.dspDealResource`` both ways, version in whole.
|
|
8
|
+
|
|
9
|
+
``Amazon-Advertising-API-ClientId`` is required; ``Scope`` and ``AccountId`` are
|
|
10
|
+
optional.
|
|
11
|
+
|
|
12
|
+
**The create answers 201; the update answers 200 with no body.**
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class DspDealsManagement(Client):
|
|
19
|
+
r"""Deals management - /dsp/inventory/deals
|
|
20
|
+
|
|
21
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/deals-management
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
@sp_endpoint('/dsp/inventory/deals', method='POST',
|
|
25
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
26
|
+
def create_deal(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
27
|
+
r"""
|
|
28
|
+
Creates a deal.
|
|
29
|
+
|
|
30
|
+
Keyword Args
|
|
31
|
+
|
|
32
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
33
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
34
|
+
|
|
35
|
+
Returns
|
|
36
|
+
ApiResponse, **201 created**.
|
|
37
|
+
"""
|
|
38
|
+
media_type = 'application/vnd.dspDealResource.v' + version + '+json'
|
|
39
|
+
headers = {'Accept': media_type, '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/{}', method='PUT',
|
|
45
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
46
|
+
def update_deal(self, dealId, version: str = "1", **kwargs) -> ApiResponse:
|
|
47
|
+
r"""
|
|
48
|
+
Updates a deal.
|
|
49
|
+
|
|
50
|
+
Path Parameters
|
|
51
|
+
|
|
52
|
+
- ``dealId`` (str): the deal. [required]
|
|
53
|
+
|
|
54
|
+
Keyword Args
|
|
55
|
+
|
|
56
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
57
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
58
|
+
|
|
59
|
+
Returns
|
|
60
|
+
ApiResponse, ``200``, with **no body**.
|
|
61
|
+
"""
|
|
62
|
+
media_type = 'application/vnd.dspDealResource.v' + version + '+json'
|
|
63
|
+
headers = {'Accept': media_type, 'Content-Type': media_type}
|
|
64
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
65
|
+
return self._request(fill_query_params(kwargs.pop('path'), dealId),
|
|
66
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Discovery - Advertised Product Categories /dsp/v1/advertisedProductCategories/list.
|
|
2
|
+
|
|
3
|
+
Contract: Discovery - Advertised Product Categories - V1 3.0. One read route,
|
|
4
|
+
plain ``application/json``.
|
|
5
|
+
|
|
6
|
+
This is the one child of Discovery that declares **no account id header**: only
|
|
7
|
+
``ClientId`` and ``Scope``.
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DspDiscoveryAdvertisedProductCategories(Client):
|
|
15
|
+
r"""Discovery - Advertised Product Categories - /dsp/v1/advertisedProductCategories
|
|
16
|
+
|
|
17
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-discovery-advertised-product-categories
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
@sp_endpoint('/dsp/v1/advertisedProductCategories/list', method='POST',
|
|
21
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
22
|
+
def list_advertised_product_categories(self, **kwargs) -> ApiResponse:
|
|
23
|
+
r"""
|
|
24
|
+
Lists the advertised product categories. Read only.
|
|
25
|
+
|
|
26
|
+
Keyword Args
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
ApiResponse, ``200``, with the categories.
|
|
30
|
+
"""
|
|
31
|
+
headers = {'Accept': 'application/json'}
|
|
32
|
+
headers['Content-Type'] = 'application/json'
|
|
33
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
34
|
+
return self._request(kwargs.pop('path'),
|
|
35
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Discovery - Apps /dsp/v1/apps/list.
|
|
2
|
+
|
|
3
|
+
Contract: Discovery - Apps - V1 3.0. One read route, plain ``application/json``.
|
|
4
|
+
|
|
5
|
+
``ClientId`` is the only required header here; ``Scope`` and
|
|
6
|
+
``Amazon-Ads-AccountId`` are both optional in the contract.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DspDiscoveryApps(Client):
|
|
14
|
+
r"""Discovery - Apps - /dsp/v1/apps
|
|
15
|
+
|
|
16
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-discovery-apps
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
@sp_endpoint('/dsp/v1/apps/list', method='POST',
|
|
20
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
21
|
+
def list_apps(self, **kwargs) -> ApiResponse:
|
|
22
|
+
r"""
|
|
23
|
+
Lists the apps a campaign can target. Read only.
|
|
24
|
+
|
|
25
|
+
Keyword Args
|
|
26
|
+
|
|
27
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
ApiResponse, ``200``, with the apps.
|
|
31
|
+
"""
|
|
32
|
+
headers = {'Accept': 'application/json'}
|
|
33
|
+
headers['Content-Type'] = 'application/json'
|
|
34
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
35
|
+
return self._request(kwargs.pop('path'),
|
|
36
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Discovery - Domain Lists /dsp/v1/domainLists/list.
|
|
2
|
+
|
|
3
|
+
Contract: Discovery - Domain Lists - V1 3.0. One read route, plain
|
|
4
|
+
``application/json``.
|
|
5
|
+
|
|
6
|
+
``ClientId`` and ``Scope`` are required; ``Amazon-Ads-AccountId`` is optional.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DspDiscoveryDomainLists(Client):
|
|
14
|
+
r"""Discovery - Domain Lists - /dsp/v1/domainLists
|
|
15
|
+
|
|
16
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-discovery-domain-lists
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
@sp_endpoint('/dsp/v1/domainLists/list', method='POST',
|
|
20
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
21
|
+
def list_domain_lists(self, **kwargs) -> ApiResponse:
|
|
22
|
+
r"""
|
|
23
|
+
Lists the domain lists a campaign can target. Read only.
|
|
24
|
+
|
|
25
|
+
Keyword Args
|
|
26
|
+
|
|
27
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
ApiResponse, ``200``, with the lists.
|
|
31
|
+
"""
|
|
32
|
+
headers = {'Accept': 'application/json'}
|
|
33
|
+
headers['Content-Type'] = 'application/json'
|
|
34
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
35
|
+
return self._request(kwargs.pop('path'),
|
|
36
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Discovery - Geo locations /dsp/geoLocations.
|
|
2
|
+
|
|
3
|
+
Contract: DSP Discovery 3.0. One **GET** route, the only read of Discovery that
|
|
4
|
+
needs no body: the filters are query parameters.
|
|
5
|
+
|
|
6
|
+
Path is ``/dsp/geoLocations``, with no ``v1``: unlike its siblings, this one is
|
|
7
|
+
not versioned in the path nor in the media type.
|
|
8
|
+
|
|
9
|
+
``ClientId`` and ``Scope`` are required; ``Amazon-Ads-AccountId`` is optional.
|
|
10
|
+
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DspDiscoveryGeoLocations(Client):
|
|
17
|
+
r"""Discovery - Geo locations - /dsp/geoLocations
|
|
18
|
+
|
|
19
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-discovery-geo
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@sp_endpoint('/dsp/geoLocations', method='GET',
|
|
23
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
24
|
+
def list_geo_locations(self, **kwargs) -> ApiResponse:
|
|
25
|
+
r"""
|
|
26
|
+
Lists the geographic locations a campaign can target. Read only.
|
|
27
|
+
|
|
28
|
+
Query Params
|
|
29
|
+
|
|
30
|
+
- ``geoLocationIdFilter``, ``textQuery``, ``maxResults``, ``nextToken``.
|
|
31
|
+
[optional]
|
|
32
|
+
|
|
33
|
+
Keyword Args
|
|
34
|
+
|
|
35
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
36
|
+
|
|
37
|
+
Returns
|
|
38
|
+
ApiResponse, ``200``, with the locations.
|
|
39
|
+
"""
|
|
40
|
+
headers = {'Accept': 'application/json'}
|
|
41
|
+
return self._request(kwargs.pop('path'),
|
|
42
|
+
params=kwargs, headers=headers)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Discovery - IAB Content Categories /dsp/v1/iabContentCategories/list.
|
|
2
|
+
|
|
3
|
+
Contract: Discovery - IAB Content Categories - V1 3.0. One read route, and one
|
|
4
|
+
of the few that speaks a ``vnd`` type: ``vnd.dspiabcontentcategories.v<n>``.
|
|
5
|
+
|
|
6
|
+
``ClientId`` and ``Scope`` are required; no account id header.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DspDiscoveryIabContentCategories(Client):
|
|
14
|
+
r"""Discovery - IAB Content Categories - /dsp/v1/iabContentCategories
|
|
15
|
+
|
|
16
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-discovery-iab-content
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
@sp_endpoint('/dsp/v1/iabContentCategories/list', method='POST',
|
|
20
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
21
|
+
def list_iab_content_categories(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
22
|
+
r"""
|
|
23
|
+
Lists the IAB content categories a campaign can target. Read only.
|
|
24
|
+
|
|
25
|
+
Keyword Args
|
|
26
|
+
|
|
27
|
+
- ``version`` (str): the version in the media type, ``1``. [optional]
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
ApiResponse, ``200``, with the categories.
|
|
31
|
+
"""
|
|
32
|
+
media_type = 'application/vnd.dspiabcontentcategories.v' + version + '+json'
|
|
33
|
+
headers = {'Accept': media_type}
|
|
34
|
+
headers['Content-Type'] = media_type
|
|
35
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
36
|
+
return self._request(kwargs.pop('path'),
|
|
37
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Discovery - Inventory Source Exchanges /dsp/v1/inventorySourceExchanges/list.
|
|
2
|
+
|
|
3
|
+
Contract: Discovery - Inventory Source Exchanges - V1 3.0. One read route, plain
|
|
4
|
+
``application/json``.
|
|
5
|
+
|
|
6
|
+
``ClientId`` is required; ``Scope`` and ``Amazon-Ads-AccountId`` are optional.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DspDiscoveryInventorySourceExchanges(Client):
|
|
14
|
+
r"""Discovery - Inventory Source Exchanges - /dsp/v1/inventorySourceExchanges
|
|
15
|
+
|
|
16
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-discovery-inventory-source-exchanges
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
@sp_endpoint('/dsp/v1/inventorySourceExchanges/list', method='POST',
|
|
20
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
21
|
+
def list_inventory_source_exchanges(self, **kwargs) -> ApiResponse:
|
|
22
|
+
r"""
|
|
23
|
+
Lists the inventory source exchanges. Read only.
|
|
24
|
+
|
|
25
|
+
Keyword Args
|
|
26
|
+
|
|
27
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
ApiResponse, ``200``, with the exchanges.
|
|
31
|
+
"""
|
|
32
|
+
headers = {'Accept': 'application/json'}
|
|
33
|
+
headers['Content-Type'] = 'application/json'
|
|
34
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
35
|
+
return self._request(kwargs.pop('path'),
|
|
36
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""Discovery - Product and Product Category /dsp/v1 and /dsp/v2.
|
|
2
|
+
|
|
3
|
+
Contract: Discovery - Product and Product Category 3.0, the first child of
|
|
4
|
+
*Discovery*. Four read routes, two generations side by side.
|
|
5
|
+
|
|
6
|
+
**The two generations are not the same shape:** ``v1`` speaks
|
|
7
|
+
``vnd.dspproductcategories`` and ``vnd.dspproducts``, while ``v2`` speaks plain
|
|
8
|
+
``application/json``. The path carries the version, not the media type, which is
|
|
9
|
+
why there is no ``version`` argument here: ``v1`` and ``v2`` are separate
|
|
10
|
+
methods with their own paths.
|
|
11
|
+
|
|
12
|
+
``ClientId`` and ``Amazon-Ads-AccountId`` are required, ``Scope`` is optional.
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class DspDiscoveryProducts(Client):
|
|
20
|
+
r"""Discovery - Product and Product Category - /dsp/v1 and /dsp/v2
|
|
21
|
+
|
|
22
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-category-discovery
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
@sp_endpoint('/dsp/v1/productCategories/list', method='POST',
|
|
26
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
27
|
+
def list_product_categories(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
28
|
+
r"""
|
|
29
|
+
Lists the product categories a campaign can target. Version 1 of the route.
|
|
30
|
+
|
|
31
|
+
Keyword Args
|
|
32
|
+
|
|
33
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
34
|
+
|
|
35
|
+
Returns
|
|
36
|
+
ApiResponse, ``200``, with the categories.
|
|
37
|
+
"""
|
|
38
|
+
media_type = 'application/vnd.dspproductcategories.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/v1/products/list', method='POST',
|
|
46
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
47
|
+
def list_products(self, version: str = "1", **kwargs) -> ApiResponse:
|
|
48
|
+
r"""
|
|
49
|
+
Lists the products a campaign can target. Version 1 of the route.
|
|
50
|
+
|
|
51
|
+
Keyword Args
|
|
52
|
+
|
|
53
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
ApiResponse, ``200``, with the products.
|
|
57
|
+
"""
|
|
58
|
+
media_type = 'application/vnd.dspproducts.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/v2/productCategories/list', method='POST',
|
|
66
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
67
|
+
def list_product_categories_v2(self, **kwargs) -> ApiResponse:
|
|
68
|
+
r"""
|
|
69
|
+
Lists the product categories. Version 2 speaks plain ``application/json``:
|
|
70
|
+
no ``vnd`` and no version, unlike the v1 route above.
|
|
71
|
+
|
|
72
|
+
Keyword Args
|
|
73
|
+
|
|
74
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
75
|
+
|
|
76
|
+
Returns
|
|
77
|
+
ApiResponse, ``200``, with the categories.
|
|
78
|
+
"""
|
|
79
|
+
headers = {'Accept': 'application/json'}
|
|
80
|
+
headers['Content-Type'] = 'application/json'
|
|
81
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
82
|
+
return self._request(kwargs.pop('path'),
|
|
83
|
+
data=body, params=kwargs, headers=headers)
|
|
84
|
+
|
|
85
|
+
@sp_endpoint('/dsp/v2/products/list', method='POST',
|
|
86
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
87
|
+
def list_products_v2(self, **kwargs) -> ApiResponse:
|
|
88
|
+
r"""
|
|
89
|
+
Lists the products. Version 2 speaks plain ``application/json``.
|
|
90
|
+
|
|
91
|
+
Keyword Args
|
|
92
|
+
|
|
93
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
94
|
+
|
|
95
|
+
Returns
|
|
96
|
+
ApiResponse, ``200``, with the products.
|
|
97
|
+
"""
|
|
98
|
+
headers = {'Accept': 'application/json'}
|
|
99
|
+
headers['Content-Type'] = 'application/json'
|
|
100
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
101
|
+
return self._request(kwargs.pop('path'),
|
|
102
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Discovery - Third-party Target Segments /dsp/v1/thirdPartyTargetSegments/list.
|
|
2
|
+
|
|
3
|
+
Contract: Discovery - Third-party Target Segments - V1 3.0. One read route,
|
|
4
|
+
plain ``application/json``.
|
|
5
|
+
|
|
6
|
+
All three headers are required here, ``Scope`` included.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DspDiscoveryThirdPartyTargetSegments(Client):
|
|
14
|
+
r"""Discovery - Third-party Target Segments - /dsp/v1/thirdPartyTargetSegments
|
|
15
|
+
|
|
16
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-thirdparty-target-segments
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
@sp_endpoint('/dsp/v1/thirdPartyTargetSegments/list', method='POST',
|
|
20
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
21
|
+
def list_third_party_target_segments(self, **kwargs) -> ApiResponse:
|
|
22
|
+
r"""
|
|
23
|
+
Lists the third-party target segments a campaign can target. Read only.
|
|
24
|
+
|
|
25
|
+
Keyword Args
|
|
26
|
+
|
|
27
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
ApiResponse, ``200``, with the segments.
|
|
31
|
+
"""
|
|
32
|
+
headers = {'Accept': 'application/json'}
|
|
33
|
+
headers['Content-Type'] = 'application/json'
|
|
34
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
35
|
+
return self._request(kwargs.pop('path'),
|
|
36
|
+
data=body, params=kwargs, headers=headers)
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""Frequency group associations /frequencyGroups/v1.
|
|
2
|
+
|
|
3
|
+
Contract: D16GFMApiFrequencyGroupAssociationV1 3.0, the *Frequency groups
|
|
4
|
+
associations* entry at the first level of *Amazon DSP*. Six routes in three
|
|
5
|
+
pairs: associate, list the associations, and list the candidates.
|
|
6
|
+
|
|
7
|
+
The success codes differ per operation and there are four of them: **201** on the
|
|
8
|
+
advertiser association, **204** on the campaign association (both with **no
|
|
9
|
+
body**), **207** on the two association lists, and **200** on the two candidate
|
|
10
|
+
lists.
|
|
11
|
+
|
|
12
|
+
Plain ``application/json``, and unlike its sibling Frequency groups, here all
|
|
13
|
+
three headers are **required**: ``Amazon-Advertising-API-ClientId``,
|
|
14
|
+
``Amazon-Advertising-API-Scope`` and ``Amazon-Ads-AccountId``.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DspFrequencyAssociations(Client):
|
|
21
|
+
r"""Frequency group associations - /frequencyGroups/v1
|
|
22
|
+
|
|
23
|
+
Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-frequency-group-association
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
@sp_endpoint('/frequencyGroups/v1/advertiserAssociations', method='PUT',
|
|
27
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
28
|
+
def associate_advertisers(self, **kwargs) -> ApiResponse:
|
|
29
|
+
r"""
|
|
30
|
+
Associates frequency groups with advertisers.
|
|
31
|
+
|
|
32
|
+
Keyword Args
|
|
33
|
+
|
|
34
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
ApiResponse, **201**, with **no body**. Do not read the payload.
|
|
38
|
+
"""
|
|
39
|
+
headers = {'Accept': 'application/json',
|
|
40
|
+
'Content-Type': 'application/json'}
|
|
41
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
42
|
+
return self._request(fill_query_params(kwargs.pop('path')),
|
|
43
|
+
data=body, params=kwargs, headers=headers)
|
|
44
|
+
|
|
45
|
+
@sp_endpoint('/frequencyGroups/v1/advertiserAssociations/list', method='POST',
|
|
46
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
47
|
+
def list_advertiser_associations(self, **kwargs) -> ApiResponse:
|
|
48
|
+
r"""
|
|
49
|
+
Lists the advertiser associations. Read only.
|
|
50
|
+
|
|
51
|
+
Keyword Args
|
|
52
|
+
|
|
53
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
undefined
|
|
57
|
+
"""
|
|
58
|
+
headers = {'Accept': 'application/json',
|
|
59
|
+
'Content-Type': 'application/json'}
|
|
60
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
61
|
+
return self._request(fill_query_params(kwargs.pop('path')),
|
|
62
|
+
data=body, params=kwargs, headers=headers)
|
|
63
|
+
|
|
64
|
+
@sp_endpoint('/frequencyGroups/v1/advertisers/list', method='POST',
|
|
65
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
66
|
+
def list_advertisers(self, **kwargs) -> ApiResponse:
|
|
67
|
+
r"""
|
|
68
|
+
Lists the advertisers a frequency group can be associated with. Read only.
|
|
69
|
+
|
|
70
|
+
Keyword Args
|
|
71
|
+
|
|
72
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
undefined
|
|
76
|
+
"""
|
|
77
|
+
headers = {'Accept': 'application/json',
|
|
78
|
+
'Content-Type': 'application/json'}
|
|
79
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
80
|
+
return self._request(fill_query_params(kwargs.pop('path')),
|
|
81
|
+
data=body, params=kwargs, headers=headers)
|
|
82
|
+
|
|
83
|
+
@sp_endpoint('/frequencyGroups/v1/campaignAssociations', method='PUT',
|
|
84
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
85
|
+
def associate_campaigns(self, **kwargs) -> ApiResponse:
|
|
86
|
+
r"""
|
|
87
|
+
Associates frequency groups with campaigns.
|
|
88
|
+
|
|
89
|
+
Keyword Args
|
|
90
|
+
|
|
91
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
92
|
+
|
|
93
|
+
Returns
|
|
94
|
+
ApiResponse, **204**, with **no body**.
|
|
95
|
+
"""
|
|
96
|
+
headers = {'Accept': 'application/json',
|
|
97
|
+
'Content-Type': 'application/json'}
|
|
98
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
99
|
+
return self._request(fill_query_params(kwargs.pop('path')),
|
|
100
|
+
data=body, params=kwargs, headers=headers)
|
|
101
|
+
|
|
102
|
+
@sp_endpoint('/frequencyGroups/v1/campaignAssociations/list', method='POST',
|
|
103
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
104
|
+
def list_campaign_associations(self, **kwargs) -> ApiResponse:
|
|
105
|
+
r"""
|
|
106
|
+
Lists the campaign associations. Read only.
|
|
107
|
+
|
|
108
|
+
Keyword Args
|
|
109
|
+
|
|
110
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
undefined
|
|
114
|
+
"""
|
|
115
|
+
headers = {'Accept': 'application/json',
|
|
116
|
+
'Content-Type': 'application/json'}
|
|
117
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
118
|
+
return self._request(fill_query_params(kwargs.pop('path')),
|
|
119
|
+
data=body, params=kwargs, headers=headers)
|
|
120
|
+
|
|
121
|
+
@sp_endpoint('/frequencyGroups/v1/campaigns/list', method='POST',
|
|
122
|
+
headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
|
|
123
|
+
def list_campaigns(self, **kwargs) -> ApiResponse:
|
|
124
|
+
r"""
|
|
125
|
+
Lists the campaigns a frequency group can be associated with. Read only.
|
|
126
|
+
|
|
127
|
+
Keyword Args
|
|
128
|
+
|
|
129
|
+
- ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
|
|
130
|
+
|
|
131
|
+
Returns
|
|
132
|
+
undefined
|
|
133
|
+
"""
|
|
134
|
+
headers = {'Accept': 'application/json',
|
|
135
|
+
'Content-Type': 'application/json'}
|
|
136
|
+
body = Utils.convert_body(kwargs.pop('body'), False)
|
|
137
|
+
return self._request(fill_query_params(kwargs.pop('path')),
|
|
138
|
+
data=body, params=kwargs, headers=headers)
|