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.
Files changed (41) hide show
  1. ad_api/api/__init__.py +68 -0
  2. ad_api/api/dsp_ad_creative_association.py +147 -0
  3. ad_api/api/dsp_ad_group_and_campaign.py +139 -0
  4. ad_api/api/dsp_audience_create.py +53 -0
  5. ad_api/api/dsp_bid_adjustments.py +193 -0
  6. ad_api/api/dsp_campaign_flights.py +119 -0
  7. ad_api/api/dsp_campaign_insights.py +59 -0
  8. ad_api/api/dsp_combined_audiences.py +83 -0
  9. ad_api/api/dsp_conversion_tracking_products.py +92 -0
  10. ad_api/api/dsp_conversions.py +442 -0
  11. ad_api/api/dsp_creatives.py +114 -0
  12. ad_api/api/dsp_deal_permissions.py +170 -0
  13. ad_api/api/dsp_deal_proposals.py +440 -0
  14. ad_api/api/dsp_deals.py +204 -0
  15. ad_api/api/dsp_deals_management.py +66 -0
  16. ad_api/api/dsp_discovery_advertised_product_categories.py +35 -0
  17. ad_api/api/dsp_discovery_apps.py +36 -0
  18. ad_api/api/dsp_discovery_domain_lists.py +36 -0
  19. ad_api/api/dsp_discovery_geo_locations.py +42 -0
  20. ad_api/api/dsp_discovery_iab_content.py +37 -0
  21. ad_api/api/dsp_discovery_inventory_source_exchanges.py +36 -0
  22. ad_api/api/dsp_discovery_products.py +102 -0
  23. ad_api/api/dsp_discovery_third_party_target_segments.py +36 -0
  24. ad_api/api/dsp_frequency_associations.py +138 -0
  25. ad_api/api/dsp_frequency_groups.py +112 -0
  26. ad_api/api/dsp_frequency_insights.py +85 -0
  27. ad_api/api/dsp_guidance.py +111 -0
  28. ad_api/api/dsp_inherited_settings.py +133 -0
  29. ad_api/api/dsp_inventory_groups.py +209 -0
  30. ad_api/api/dsp_measurement.py +693 -0
  31. ad_api/api/dsp_quick_actions.py +177 -0
  32. ad_api/api/dsp_seats.py +43 -0
  33. ad_api/api/dsp_seats_management.py +84 -0
  34. ad_api/api/dsp_target_kpi_recommendations.py +44 -0
  35. ad_api/api/dsp_targeting.py +98 -0
  36. ad_api/version.py +1 -1
  37. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/METADATA +1 -1
  38. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/RECORD +41 -7
  39. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/WHEEL +0 -0
  40. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/licenses/LICENSE +0 -0
  41. {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,119 @@
1
+ """Campaign flights /dsp/v1/campaigns/{campaignId}/flights.
2
+
3
+ Contract: Campaign Flights - V1 3.0. The flights of a campaign: the windows in
4
+ which it delivers, always scoped to one campaign through the path.
5
+
6
+ Plain ``application/json``. Two things to watch:
7
+
8
+ - **204 is the usual answer**, with no body, on the create, the delete and the
9
+ patch. The create can also answer 200; the contract declares both.
10
+ - The list is a POST that answers 200.
11
+
12
+ ``Amazon-Advertising-API-ClientId`` and ``Amazon-Ads-AccountId`` are required,
13
+ ``Scope`` is optional.
14
+ """
15
+
16
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
17
+
18
+
19
+ class DspCampaignFlights(Client):
20
+ r"""Campaign flights - /dsp/v1/campaigns/{campaignId}/flights
21
+
22
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-ad-group-campaign-flights
23
+ """
24
+
25
+ @sp_endpoint('/dsp/v1/campaigns/{}/flights', method='POST',
26
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
27
+ def create_flights(self, campaignId, **kwargs) -> ApiResponse:
28
+ r"""
29
+ Creates flights on a campaign.
30
+
31
+ Path Parameters
32
+
33
+ - ``campaignId`` (str): the campaign. [required]
34
+
35
+ Keyword Args
36
+
37
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
38
+
39
+ Returns
40
+ ApiResponse, **204** with no body, or ``200``. The contract declares both.
41
+ """
42
+ headers = {'Accept': 'application/json'}
43
+ headers['Content-Type'] = 'application/json'
44
+ body = Utils.convert_body(kwargs.pop('body'), False)
45
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
46
+ data=body, params=kwargs, headers=headers)
47
+
48
+ @sp_endpoint('/dsp/v1/campaigns/{}/flights', method='PATCH',
49
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
50
+ def update_flights(self, campaignId, **kwargs) -> ApiResponse:
51
+ r"""
52
+ Updates the flights of a campaign. Same path as the create.
53
+
54
+ Path Parameters
55
+
56
+ - ``campaignId`` (str): the campaign. [required]
57
+
58
+ Keyword Args
59
+
60
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
61
+
62
+ Returns
63
+ ApiResponse, **204**, with **no body**. Do not read the payload.
64
+ """
65
+ headers = {'Accept': 'application/json'}
66
+ headers['Content-Type'] = 'application/json'
67
+ body = Utils.convert_body(kwargs.pop('body'), False)
68
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
69
+ data=body, params=kwargs, headers=headers)
70
+
71
+ @sp_endpoint('/dsp/v1/campaigns/{}/flights/delete', method='POST',
72
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
73
+ def delete_flights(self, campaignId, **kwargs) -> ApiResponse:
74
+ r"""
75
+ Deletes flights from a campaign.
76
+
77
+ Path Parameters
78
+
79
+ - ``campaignId`` (str): the campaign. [required]
80
+
81
+ Keyword Args
82
+
83
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
84
+
85
+ Returns
86
+ ApiResponse, **204**, with **no body**.
87
+ """
88
+ headers = {'Accept': 'application/json'}
89
+ headers['Content-Type'] = 'application/json'
90
+ body = Utils.convert_body(kwargs.pop('body'), False)
91
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
92
+ data=body, params=kwargs, headers=headers)
93
+
94
+ @sp_endpoint('/dsp/v1/campaigns/{}/flights/list', method='POST',
95
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
96
+ def list_flights(self, campaignId, **kwargs) -> ApiResponse:
97
+ r"""
98
+ Lists the flights of a campaign. Read only.
99
+
100
+ Path Parameters
101
+
102
+ - ``campaignId`` (str): the campaign. [required]
103
+
104
+ Query Params
105
+
106
+ - ``maxResults``, ``nextToken``. [optional]
107
+
108
+ Keyword Args
109
+
110
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
111
+
112
+ Returns
113
+ ApiResponse, ``200``, with the flights.
114
+ """
115
+ headers = {'Accept': 'application/json'}
116
+ headers['Content-Type'] = 'application/json'
117
+ body = Utils.convert_body(kwargs.pop('body'), False)
118
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
119
+ data=body, params=kwargs, headers=headers)
@@ -0,0 +1,59 @@
1
+ """Performance+ campaign insights /dsp/v1/campaign/insights.
2
+
3
+ Contract: D16GDspApiCampaignInsightsV1 3.0, the *Performance+ insights (beta)*
4
+ entry at the first level of *Amazon DSP*. One route, ``POST``, and it does not
5
+ create anything: it reads the campaign and ad group performance insights for the
6
+ ids given. Amazon uses ``POST`` because the request body carries a list.
7
+
8
+ Media type ``application/vnd.dspDspCampaignInsights.v1+json`` for the body and
9
+ for the answer, and the success status is **207**, not 200.
10
+
11
+ Headers: the contract marks ``Amazon-Advertising-API-ClientId``,
12
+ ``Amazon-Advertising-API-Scope`` and ``Amazon-Advertising-AccountId`` as
13
+ required, and its operation page names ``Amazon-Advertising-AccountId`` as the
14
+ identity parameter. The client knows that header as ``Amazon-Ads-AccountId``, so
15
+ that is the one declared; a caller picks between it and the scope with
16
+ ``selector``.
17
+ """
18
+
19
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
20
+
21
+
22
+ class DspCampaignInsights(Client):
23
+ r"""Performance+ insights - /dsp/v1/campaign/insights
24
+
25
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-campaign-insights
26
+ """
27
+
28
+ @sp_endpoint('/dsp/v1/campaign/insights', method='POST',
29
+ headers=['Amazon-Advertising-API-Scope',
30
+ 'Amazon-Ads-AccountId'])
31
+ def get_campaign_insights(self, version: str = "1", **kwargs) -> ApiResponse:
32
+ r"""
33
+ Reads the campaign and ad group performance insights for the ids given.
34
+ Read only, despite the ``POST``.
35
+
36
+ Request Body [Required]
37
+ | **requests** (list): one to twenty-five entries. Each one takes
38
+ | ``campaignId`` (required), ``insightType`` (required) and,
39
+ | optionally, ``adGroupId``.
40
+
41
+ ``insightType`` is ``PERFORMANCE_PLUS_SHOPPER_TRAIT``, ``PERSONA`` or
42
+ ``TARGETING_PERFORMANCE``.
43
+
44
+ Keyword Args
45
+
46
+ - ``version`` (str): media type version. Defaults to ``1``. [optional]
47
+ - ``selector`` (str): ``'profile_id'`` or ``'account_id'``; decides
48
+ which identity header travels. [optional]
49
+
50
+ Returns
51
+ ApiResponse, **207** multi-status: each request can answer or fail on
52
+ its own. Requires ``campaign_view``.
53
+ """
54
+ media_type = ('application/vnd.dspDspCampaignInsights.v'
55
+ + version + '+json')
56
+ headers = {'Accept': media_type, 'Content-Type': media_type}
57
+ body = Utils.convert_body(kwargs.pop('body'), False)
58
+ return self._request(fill_query_params(kwargs.pop('path')),
59
+ data=body, params=kwargs, headers=headers)
@@ -0,0 +1,83 @@
1
+ """Combined audiences /dsp/audiences/combinedAudiences.
2
+
3
+ Contract: Combined Audience API 3.0, the *Combined audiences* entry at the first
4
+ level of *Amazon DSP*. Two routes: one creates a combined audience and one reads
5
+ it back.
6
+
7
+ The media types do not match each other. The create takes
8
+ ``application/vnd.createcombinedaudiencerequestbody.v<n>+json`` and answers
9
+ ``application/vnd.createcombinedaudienceresponse.v<n>+json``; the read answers
10
+ ``application/vnd.getcombinedaudiencedetailsresponse.v<n>+json``. Each method
11
+ builds its own from a version argument.
12
+
13
+ Headers: ``Amazon-Advertising-API-ClientId`` and
14
+ ``Amazon-Advertising-API-Scope``, both required, and only those. The advertiser
15
+ goes in the query string as ``advertiserId``.
16
+ """
17
+
18
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
19
+
20
+
21
+ class DspCombinedAudiences(Client):
22
+ r"""Combined audiences - /dsp/audiences/combinedAudiences
23
+
24
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-combined-audiences
25
+ """
26
+
27
+ @sp_endpoint('/dsp/audiences/combinedAudiences', method='POST',
28
+ headers=['Amazon-Advertising-API-Scope'])
29
+ def create_combined_audience(self, version: str = "1", **kwargs) -> ApiResponse:
30
+ r"""
31
+ Creates a combined audience from the ones it is built on.
32
+
33
+ Query [Required]
34
+
35
+ - ``advertiserId`` (str): the DSP advertiser. [required]
36
+
37
+ Request Body [Required]
38
+ The body the contract publishes for a combined audience: its name
39
+ and the audiences or expressions it combines.
40
+
41
+ Keyword Args
42
+
43
+ - ``version`` (str): media type version, used for the body and for the
44
+ answer. Defaults to ``1``. [optional]
45
+
46
+ Returns
47
+ ApiResponse, ``200``, with the created audience.
48
+ """
49
+ request_type = ('application/vnd.createcombinedaudiencerequestbody.v'
50
+ + version + '+json')
51
+ accept = ('application/vnd.createcombinedaudienceresponse.v'
52
+ + version + '+json')
53
+ headers = {'Accept': accept, 'Content-Type': request_type}
54
+ body = Utils.convert_body(kwargs.pop('body'), False)
55
+ return self._request(fill_query_params(kwargs.pop('path')),
56
+ data=body, params=kwargs, headers=headers)
57
+
58
+ @sp_endpoint('/dsp/audiences/combinedAudiences/{}', method='GET',
59
+ headers=['Amazon-Advertising-API-Scope'])
60
+ def get_combined_audience(self, audienceId, version: str = "1", **kwargs) -> ApiResponse:
61
+ r"""
62
+ Reads one combined audience. Read only.
63
+
64
+ Path Parameters
65
+
66
+ - ``audienceId`` (str): the combined audience. [required]
67
+
68
+ Query [Required]
69
+
70
+ - ``advertiserId`` (str): the DSP advertiser. [required]
71
+
72
+ Keyword Args
73
+
74
+ - ``version`` (str): media type version. Defaults to ``1``. [optional]
75
+
76
+ Returns
77
+ ApiResponse, ``200``, with the audiences the combination holds.
78
+ """
79
+ accept = ('application/vnd.getcombinedaudiencedetailsresponse.v'
80
+ + version + '+json')
81
+ headers = {'Accept': accept}
82
+ return self._request(fill_query_params(kwargs.pop('path'), audienceId),
83
+ params=kwargs, headers=headers)
@@ -0,0 +1,92 @@
1
+ """Conversion Tracking - Products /dsp/v1/campaigns/{campaignId}/conversionTracking.
2
+
3
+ Contract: Campaign Conversion Tracking - Products - V1 3.0, a child of
4
+ *Campaign management*. Which products a campaign conversion tracks, always
5
+ scoped to one campaign through the path.
6
+
7
+ Plain ``application/json``, no version. ``Amazon-Advertising-API-ClientId`` and
8
+ ``Amazon-Ads-AccountId`` are required, ``Scope`` is optional.
9
+
10
+ The read answers 200; both writes answer **207**, one result per product.
11
+ """
12
+
13
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
14
+
15
+
16
+ class DspConversionTrackingProducts(Client):
17
+ r"""Conversion Tracking - Products - /dsp/v1/campaigns/{campaignId}/conversionTracking
18
+
19
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-ad-group-cvrtracking-products
20
+ """
21
+
22
+ @sp_endpoint('/dsp/v1/campaigns/{}/conversionTracking/products', method='GET',
23
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
24
+ def list_conversion_tracking_products(self, campaignId, **kwargs) -> ApiResponse:
25
+ r"""
26
+ Lists the products a campaign conversion tracks. Read only.
27
+
28
+ Path Parameters
29
+
30
+ - ``campaignId`` (str): the campaign. [required]
31
+
32
+ Query Params
33
+
34
+ - ``maxResults``, ``nextToken``. [optional]
35
+
36
+ Keyword Args
37
+
38
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
39
+
40
+ Returns
41
+ ApiResponse, ``200``, with the products and the pagination.
42
+ """
43
+ headers = {'Accept': 'application/json'}
44
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
45
+ params=kwargs, headers=headers)
46
+
47
+ @sp_endpoint('/dsp/v1/campaigns/{}/conversionTracking/products', method='POST',
48
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
49
+ def create_conversion_tracking_products(self, campaignId, **kwargs) -> ApiResponse:
50
+ r"""
51
+ Adds products to a campaign conversion.
52
+
53
+ Path Parameters
54
+
55
+ - ``campaignId`` (str): the campaign. [required]
56
+
57
+ Keyword Args
58
+
59
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
60
+
61
+ Returns
62
+ ApiResponse, **207** multi-status, one per product.
63
+ """
64
+ headers = {'Accept': 'application/json'}
65
+ headers['Content-Type'] = 'application/json'
66
+ body = Utils.convert_body(kwargs.pop('body'), False)
67
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
68
+ data=body, params=kwargs, headers=headers)
69
+
70
+ @sp_endpoint('/dsp/v1/campaigns/{}/conversionTracking/products/delete', method='POST',
71
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
72
+ def delete_conversion_tracking_products(self, campaignId, **kwargs) -> ApiResponse:
73
+ r"""
74
+ Removes products from a campaign conversion. A POST with ``/delete``,
75
+ because the list travels in the body.
76
+
77
+ Path Parameters
78
+
79
+ - ``campaignId`` (str): the campaign. [required]
80
+
81
+ Keyword Args
82
+
83
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
84
+
85
+ Returns
86
+ ApiResponse, **207** multi-status.
87
+ """
88
+ headers = {'Accept': 'application/json'}
89
+ headers['Content-Type'] = 'application/json'
90
+ body = Utils.convert_body(kwargs.pop('body'), False)
91
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
92
+ data=body, params=kwargs, headers=headers)