python-amazon-ad-api 1.0.4__py3-none-any.whl → 1.0.5__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/sp/__init__.py +5 -29
- ad_api/version.py +1 -1
- {python_amazon_ad_api-1.0.4.dist-info → python_amazon_ad_api-1.0.5.dist-info}/METADATA +2 -12
- {python_amazon_ad_api-1.0.4.dist-info → python_amazon_ad_api-1.0.5.dist-info}/RECORD +7 -24
- ad_api/api/dsp/__init__.py +0 -11
- ad_api/api/dsp/access_token_client.py +0 -6
- ad_api/api/dsp/client.py +0 -13
- ad_api/api/dsp/credential_provider.py +0 -15
- ad_api/api/dsp/reports.py +0 -71
- ad_api/api/sp/ad_groups.py +0 -158
- ad_api/api/sp/bid_recommendations.py +0 -81
- ad_api/api/sp/campaign_negative_keywords.py +0 -155
- ad_api/api/sp/campaigns.py +0 -398
- ad_api/api/sp/keywords.py +0 -172
- ad_api/api/sp/negative_keywords.py +0 -164
- ad_api/api/sp/negative_product_targeting.py +0 -163
- ad_api/api/sp/product_ads.py +0 -154
- ad_api/api/sp/product_targeting.py +0 -323
- ad_api/api/sp/reports.py +0 -65
- ad_api/api/sp/snapshots.py +0 -54
- ad_api/api/sp/suggested_keywords.py +0 -86
- {python_amazon_ad_api-1.0.4.dist-info → python_amazon_ad_api-1.0.5.dist-info}/WHEEL +0 -0
- {python_amazon_ad_api-1.0.4.dist-info → python_amazon_ad_api-1.0.5.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_ad_api-1.0.4.dist-info → python_amazon_ad_api-1.0.5.dist-info}/top_level.txt +0 -0
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class CampaignNegativeKeywords(Client):
|
|
5
|
-
@sp_endpoint('/v2/sp/campaignNegativeKeywords/{}', method='GET')
|
|
6
|
-
@Utils.deprecated
|
|
7
|
-
def get_campaign_negative_keyword(self, keywordId, **kwargs) -> ApiResponse:
|
|
8
|
-
r"""
|
|
9
|
-
|
|
10
|
-
get_campaign_negative_keyword(self, keywordId, \*\*kwargs) -> ApiResponse
|
|
11
|
-
|
|
12
|
-
Gets a campaign negative keyword specified by identifier.
|
|
13
|
-
|
|
14
|
-
path **keywordId**:*number* | Required. The identifier of an existing keyword.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Returns:
|
|
18
|
-
|
|
19
|
-
ApiResponse
|
|
20
|
-
|
|
21
|
-
"""
|
|
22
|
-
return self._request(fill_query_params(kwargs.pop('path'), keywordId), params=kwargs)
|
|
23
|
-
|
|
24
|
-
@sp_endpoint('/v2/sp/campaignNegativeKeywords/{}', method='DELETE')
|
|
25
|
-
@Utils.deprecated
|
|
26
|
-
def delete_campaign_negative_keyword(self, keywordId, **kwargs) -> ApiResponse:
|
|
27
|
-
r"""
|
|
28
|
-
|
|
29
|
-
delete_campaign_negative_keyword(self, keywordId, \*\*kwargs) -> ApiResponse
|
|
30
|
-
|
|
31
|
-
Archives a campaign negative keyword.
|
|
32
|
-
|
|
33
|
-
path **keywordId**:*number* | Required. The identifier of an existing keyword.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Returns:
|
|
37
|
-
|
|
38
|
-
ApiResponse
|
|
39
|
-
|
|
40
|
-
"""
|
|
41
|
-
return self._request(fill_query_params(kwargs.pop('path'), keywordId), params=kwargs)
|
|
42
|
-
|
|
43
|
-
@sp_endpoint('/v2/sp/campaignNegativeKeywords/extended/{}', method='GET')
|
|
44
|
-
@Utils.deprecated
|
|
45
|
-
def get_campaign_negative_keyword_extended(self, keywordId, **kwargs) -> ApiResponse:
|
|
46
|
-
r"""
|
|
47
|
-
|
|
48
|
-
get_campaign_negative_keyword_extended(self, keywordId, \*\*kwargs) -> ApiResponse
|
|
49
|
-
|
|
50
|
-
Gets a campaign negative keyword that has extended data fields.
|
|
51
|
-
|
|
52
|
-
path **keywordId**:*number* | Required. The identifier of an existing keyword.
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
|
|
56
|
-
ApiResponse
|
|
57
|
-
|
|
58
|
-
"""
|
|
59
|
-
return self._request(fill_query_params(kwargs.pop('path'), keywordId), params=kwargs)
|
|
60
|
-
|
|
61
|
-
@sp_endpoint('/v2/sp/campaignNegativeKeywords/extended', method='GET')
|
|
62
|
-
@Utils.deprecated
|
|
63
|
-
def list_campaign_negative_keywords_extended(self, **kwargs) -> ApiResponse:
|
|
64
|
-
r"""
|
|
65
|
-
list_campaign_negative_keywords_extended(self, \*\*kwargs) -> ApiResponse
|
|
66
|
-
|
|
67
|
-
Gets a list of campaign negative keywords that have extended data fields.
|
|
68
|
-
|
|
69
|
-
query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
|
|
70
|
-
|
|
71
|
-
query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
|
|
72
|
-
|
|
73
|
-
query **matchTypeFilter**:*string* | Optional. Restricts results to keywords with match types within the specified comma-separated list. Available values : negativePhrase, negativeExact.
|
|
74
|
-
|
|
75
|
-
query **keywordText**:*string* | Optional. Restricts results to keywords that match the specified text exactly.
|
|
76
|
-
|
|
77
|
-
query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
|
|
78
|
-
|
|
79
|
-
query **keywordIdFilter**:*string* | Optional. Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list.
|
|
80
|
-
|
|
81
|
-
Returns:
|
|
82
|
-
|
|
83
|
-
ApiResponse
|
|
84
|
-
|
|
85
|
-
"""
|
|
86
|
-
return self._request(kwargs.pop('path'), params=kwargs)
|
|
87
|
-
|
|
88
|
-
@sp_endpoint('/v2/sp/campaignNegativeKeywords', method='GET')
|
|
89
|
-
@Utils.deprecated
|
|
90
|
-
def list_campaign_negative_keywords(self, **kwargs) -> ApiResponse:
|
|
91
|
-
r"""
|
|
92
|
-
list_campaign_negative_keywords(self, \*\*kwargs) -> ApiResponse
|
|
93
|
-
|
|
94
|
-
Gets a list of campaign negative keywords.
|
|
95
|
-
|
|
96
|
-
query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
|
|
97
|
-
|
|
98
|
-
query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
|
|
99
|
-
|
|
100
|
-
query **matchTypeFilter**:*string* | Optional. Restricts results to keywords with match types within the specified comma-separated list. Available values : negativePhrase, negativeExact.
|
|
101
|
-
|
|
102
|
-
query **keywordText**:*string* | Optional. Restricts results to keywords that match the specified text exactly.
|
|
103
|
-
|
|
104
|
-
query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
|
|
105
|
-
|
|
106
|
-
query **keywordIdFilter**:*string* | Optional. Restricts results to keywords associated with campaigns specified by identifier in the comma-delimited list.
|
|
107
|
-
|
|
108
|
-
Returns:
|
|
109
|
-
|
|
110
|
-
ApiResponse
|
|
111
|
-
|
|
112
|
-
"""
|
|
113
|
-
return self._request(kwargs.pop('path'), params=kwargs)
|
|
114
|
-
|
|
115
|
-
@sp_endpoint('/v2/sp/campaignNegativeKeywords', method='POST')
|
|
116
|
-
@Utils.deprecated
|
|
117
|
-
def create_campaign_negative_keywords(self, **kwargs) -> ApiResponse:
|
|
118
|
-
r"""
|
|
119
|
-
create_campaign_negative_keywords(self, \*\*kwargs) -> ApiResponse:
|
|
120
|
-
|
|
121
|
-
Creates one or more campaign negative keywords.
|
|
122
|
-
|
|
123
|
-
body: | REQUIRED {'description': 'An array of keyword objects.}'
|
|
124
|
-
|
|
125
|
-
| '**campaignId**': *number*, {'description': 'The identifer of the campaign to which the keyword is associated.'}
|
|
126
|
-
| '**state**': *string*, {'description': 'The current resource state.' , 'Enum': '[ enabled ]'}
|
|
127
|
-
| '**keywordText**': *string*, {'description': 'The text of the expression to match against a search query.'}
|
|
128
|
-
| '**matchType**': *string*, {'description': 'The type of match.' , 'Enum': '[ negativeExact, negativePhrase ]'}
|
|
129
|
-
|
|
130
|
-
Returns:
|
|
131
|
-
|
|
132
|
-
ApiResponse
|
|
133
|
-
|
|
134
|
-
"""
|
|
135
|
-
return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs)
|
|
136
|
-
|
|
137
|
-
@sp_endpoint('/v2/sp/campaignNegativeKeywords', method='PUT')
|
|
138
|
-
@Utils.deprecated
|
|
139
|
-
def edit_campaign_negative_keywords(self, **kwargs) -> ApiResponse:
|
|
140
|
-
r"""
|
|
141
|
-
edit_campaign_negative_keywords(self, \*\*kwargs) -> ApiResponse:
|
|
142
|
-
|
|
143
|
-
Updates one or more campaign negative keywords.
|
|
144
|
-
|
|
145
|
-
body: | REQUIRED {'description': 'An array of campaign negative keywords with updated values.'}
|
|
146
|
-
|
|
147
|
-
| '**keywordId**': *number*, {'description': 'The identifer of the campaign to which the keyword is associated.'}
|
|
148
|
-
| '**state**': *string*, {'description': 'The current resource state.' , 'Enum': '[ deleted ]'}
|
|
149
|
-
|
|
150
|
-
Returns:
|
|
151
|
-
|
|
152
|
-
ApiResponse
|
|
153
|
-
|
|
154
|
-
"""
|
|
155
|
-
return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs)
|
ad_api/api/sp/campaigns.py
DELETED
|
@@ -1,398 +0,0 @@
|
|
|
1
|
-
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class Campaigns(Client):
|
|
6
|
-
r"""
|
|
7
|
-
Campaigns(account='default', marketplace: Marketplaces = Marketplaces.EU, credentials=None, debug=False)
|
|
8
|
-
|
|
9
|
-
Amazon Ads API - Sponsored Products
|
|
10
|
-
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
14
|
-
# @sp_endpoint('/v2/sp/campaigns', method='PUT')
|
|
15
|
-
# @Utils.deprecated
|
|
16
|
-
# def edit_single_campaign_assistant(
|
|
17
|
-
# self,
|
|
18
|
-
# campaign_id: int,
|
|
19
|
-
# portfolio_id: int = None,
|
|
20
|
-
# campaign_name: str = None,
|
|
21
|
-
# po_number: str = None,
|
|
22
|
-
# account_manager: str = None,
|
|
23
|
-
# campaign_status: str = None,
|
|
24
|
-
# daily_budget: int = None,
|
|
25
|
-
# start_date: str = None,
|
|
26
|
-
# end_date: str = None,
|
|
27
|
-
# premium_bid_adjustment: bool = None,
|
|
28
|
-
# strategy: str = None,
|
|
29
|
-
# predicate: str or tuple = None,
|
|
30
|
-
# percentage: str or tuple = None,
|
|
31
|
-
# **kwargs,
|
|
32
|
-
# ) -> ApiResponse:
|
|
33
|
-
# r"""
|
|
34
|
-
# edit_single_campaign_assistant(campaign_id: int, portfolio_id: int = None, campaign_name: str, po_number: str = None, account_manager: str = None, campaign_status: str = None, daily_budget: int, start_date: str, end_date: str = None, premium_bid_adjustment: bool = None, strategy:str = None, predicate:str or tuple = None, percentage:int or tuple = None, **kwargs) -> ApiResponse
|
|
35
|
-
#
|
|
36
|
-
# Edit one campaigns and create the body based on the params provided, at least one of the optional params need to be set or a INVALID_ARGUMENT code is thorwn
|
|
37
|
-
#
|
|
38
|
-
# Kwargs:
|
|
39
|
-
# | **campaign_id** (number): [required] The identifier of an existing campaign to update.
|
|
40
|
-
# | **portfolio_id** (number): [optional] The identifier of an existing portfolio to which the campaign is associated
|
|
41
|
-
# | **campaign_name** (string): [optional] A name for the campaign
|
|
42
|
-
# | **po_number** (string): [optional] 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
|
|
43
|
-
# | **account_manager** (string): [optional] A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
|
|
44
|
-
# | **campaign_status**': (string): [optional] The current resource state Values: enabled, paused, archived. Default: enabled
|
|
45
|
-
# | **daily_budget** (float): [optional] A daily budget for the campaign
|
|
46
|
-
# | **start_date** (string): [optional] A starting date for the campaign to go live. The format of the date is YYYYMMDD
|
|
47
|
-
# | **end_date** (string): [optional] An ending date for the campaign to stop running. The format of the date is YYYYMMDD
|
|
48
|
-
# | **premium_bid_adjustment**' (boolean): [optional] If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information. Tip: When Campaign has been adopted to enhanced bidding premiumBidAdjustment can not be set
|
|
49
|
-
# | **strategy** (string): [optional] The bidding strategy. 'Values': legacyForSales (Dynamic bids - down only), autoForSales (Dynamic bids - up and down), manual (Fixed bid)
|
|
50
|
-
# | **predicate** (string or tuple(str)): [optional] You can enable controls to adjust your bid based on the placement location. Specify a location where you want to use bid controls. The percentage value set is the percentage of the original bid for which you want to have your bid adjustment increased. For example, a 50% adjustment on a $1.00 bid would increase the bid to $1.50 for the opportunity to win a specified placement. 'Values': placementTop (str), placementProductPage (str), ("placementTop", "placementProductPage") (tuple)
|
|
51
|
-
# | **percentage** (float or tuple(float)): [optional] The bid adjustment percentage value. Example: 15 (float), (15, 25) (tuple)
|
|
52
|
-
#
|
|
53
|
-
# Returns:
|
|
54
|
-
#
|
|
55
|
-
# ApiResponse
|
|
56
|
-
#
|
|
57
|
-
# """
|
|
58
|
-
#
|
|
59
|
-
# optional = {}
|
|
60
|
-
#
|
|
61
|
-
# if portfolio_id is not None:
|
|
62
|
-
# optional.update({'portfolioId': portfolio_id})
|
|
63
|
-
#
|
|
64
|
-
# if campaign_name is not None:
|
|
65
|
-
# optional.update({'name': campaign_name})
|
|
66
|
-
#
|
|
67
|
-
# if po_number is not None and account_manager is not None:
|
|
68
|
-
# optional.update({"tags": {'PONumber': po_number, 'accountManager': account_manager}})
|
|
69
|
-
#
|
|
70
|
-
# if campaign_status is not None:
|
|
71
|
-
# optional.update({'state': campaign_status})
|
|
72
|
-
#
|
|
73
|
-
# if daily_budget is not None:
|
|
74
|
-
# optional.update({'dailyBudget': daily_budget})
|
|
75
|
-
#
|
|
76
|
-
# if start_date is not None:
|
|
77
|
-
# optional.update({'startDate': start_date})
|
|
78
|
-
#
|
|
79
|
-
# if end_date is not None:
|
|
80
|
-
# optional.update({'endDate': end_date})
|
|
81
|
-
#
|
|
82
|
-
# if premium_bid_adjustment is not None:
|
|
83
|
-
# optional.update({'premiumBidAdjustment': premium_bid_adjustment})
|
|
84
|
-
#
|
|
85
|
-
# if strategy is not None and predicate is None and percentage is None:
|
|
86
|
-
# optional.update({'bidding': {'strategy': strategy, 'adjustments': []}})
|
|
87
|
-
#
|
|
88
|
-
# if strategy is not None and predicate is not None and percentage is not None:
|
|
89
|
-
# if isinstance(predicate, str):
|
|
90
|
-
# optional.update(
|
|
91
|
-
# {
|
|
92
|
-
# 'bidding': {
|
|
93
|
-
# 'strategy': strategy,
|
|
94
|
-
# 'adjustments': [{'predicate': predicate, 'percentage': percentage}],
|
|
95
|
-
# }
|
|
96
|
-
# }
|
|
97
|
-
# )
|
|
98
|
-
#
|
|
99
|
-
# if isinstance(predicate, tuple) and len(predicate) == 2 and len(percentage) == 2:
|
|
100
|
-
# options = []
|
|
101
|
-
# for i in range(len(predicate)):
|
|
102
|
-
# option = {"predicate": predicate[i], "percentage": percentage[i]}
|
|
103
|
-
# options.append(option)
|
|
104
|
-
#
|
|
105
|
-
# bidding = {'strategy': strategy, 'adjustments': options}
|
|
106
|
-
#
|
|
107
|
-
# dictionary = {}
|
|
108
|
-
# dictionary["bidding"] = bidding
|
|
109
|
-
#
|
|
110
|
-
# optional.update(dictionary)
|
|
111
|
-
#
|
|
112
|
-
# required = {
|
|
113
|
-
# 'campaignId': campaign_id,
|
|
114
|
-
# }
|
|
115
|
-
#
|
|
116
|
-
# if not optional:
|
|
117
|
-
# description = 'No changes submitted for entity %s' % campaign_id
|
|
118
|
-
# obj = [{'code': 'INVALID_ARGUMENT', 'description': description}]
|
|
119
|
-
# return ApiResponse(obj)
|
|
120
|
-
# else:
|
|
121
|
-
# required.update(optional)
|
|
122
|
-
# data_str = json.dumps([required])
|
|
123
|
-
# return self._request(kwargs.pop('path'), data=data_str, params=kwargs)
|
|
124
|
-
#
|
|
125
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
126
|
-
# @sp_endpoint('/v2/sp/campaigns', method='POST')
|
|
127
|
-
# @Utils.deprecated
|
|
128
|
-
# def create_single_campaign_assistant(
|
|
129
|
-
# self,
|
|
130
|
-
# campaign_name: str,
|
|
131
|
-
# targeting_type: str,
|
|
132
|
-
# daily_budget: int,
|
|
133
|
-
# start_date: str,
|
|
134
|
-
# end_date: str = None,
|
|
135
|
-
# campaign_status: str = "enabled",
|
|
136
|
-
# portfolio_id: int = None,
|
|
137
|
-
# po_number: str = None,
|
|
138
|
-
# account_manager: str = None,
|
|
139
|
-
# premium_bid_adjustment: bool = None,
|
|
140
|
-
# strategy: str = None,
|
|
141
|
-
# predicate: str or tuple = None,
|
|
142
|
-
# percentage: int or tuple = None,
|
|
143
|
-
# **kwargs,
|
|
144
|
-
# ) -> ApiResponse:
|
|
145
|
-
# r"""
|
|
146
|
-
# create_single_campaign_assistant(campaign_name: str,targeting_type: str, daily_budget: int, start_date: str, end_date: str = None, campaign_status: str = "enabled", portfolio_id: int = None, po_number: str = None, account_manager: str = None, premium_bid_adjustment: bool = False, strategy:str = None, predicate:str = None, percentage:int = None, **kwargs) -> ApiResponse
|
|
147
|
-
#
|
|
148
|
-
# Creates one campaigns and create the body based on the params provided
|
|
149
|
-
#
|
|
150
|
-
# Kwargs:
|
|
151
|
-
#
|
|
152
|
-
# | **campaign_name** (string): [required] A name for the campaign
|
|
153
|
-
# | **campaign_type** (string): [fixed] The advertising product managed by this campaign. Value: sponsoredProducts
|
|
154
|
-
# | **targeting_type** (string): [required] The type of targeting for the campaign. Values: manual, auto
|
|
155
|
-
# | **daily_budget** (float): [required] A daily budget for the campaign
|
|
156
|
-
# | **start_date** (string): [required] A starting date for the campaign to go live. The format of the date is YYYYMMDD
|
|
157
|
-
# | **end_date** (string): [optional] An ending date for the campaign to stop running. The format of the date is YYYYMMDD
|
|
158
|
-
# | **campaign_status**': (string): [optional] The current resource state Values: enabled, paused, archived. Default: enabled
|
|
159
|
-
# | **portfolio_id** (number): [optional] The identifier of an existing portfolio to which the campaign is associated
|
|
160
|
-
# | **po_number** (string): [optional] 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
|
|
161
|
-
# | **account_manager** (string): [optional] A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
|
|
162
|
-
# | **premium_bid_adjustment**' (boolean) If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.
|
|
163
|
-
# | **strategy** (string): [optional] The bidding strategy. 'Values': legacyForSales (Dynamic bids - down only), autoForSales (Dynamic bids - up and down), manual (Fixed bid)
|
|
164
|
-
# | **predicate** (string): [optional] You can enable controls to adjust your bid based on the placement location. Specify a location where you want to use bid controls. The percentage value set is the percentage of the original bid for which you want to have your bid adjustment increased. For example, a 50% adjustment on a $1.00 bid would increase the bid to $1.50 for the opportunity to win a specified placement. 'Values': placementTop, placementProductPage
|
|
165
|
-
# | **percentage** (float): [optional] The bid adjustment percentage value.
|
|
166
|
-
#
|
|
167
|
-
# Returns:
|
|
168
|
-
#
|
|
169
|
-
# ApiResponse
|
|
170
|
-
#
|
|
171
|
-
# """
|
|
172
|
-
#
|
|
173
|
-
# optional = {}
|
|
174
|
-
#
|
|
175
|
-
# if portfolio_id is not None:
|
|
176
|
-
# optional.update({'portfolioId': portfolio_id})
|
|
177
|
-
#
|
|
178
|
-
# if po_number is not None and account_manager is not None:
|
|
179
|
-
# optional.update({"tags": {'PONumber': po_number, 'accountManager': account_manager}})
|
|
180
|
-
#
|
|
181
|
-
# if end_date is not None:
|
|
182
|
-
# optional.update({'endDate': end_date})
|
|
183
|
-
#
|
|
184
|
-
# if premium_bid_adjustment is not None:
|
|
185
|
-
# optional.update({'premiumBidAdjustment': premium_bid_adjustment})
|
|
186
|
-
#
|
|
187
|
-
# if strategy is not None and predicate is not None and percentage is not None:
|
|
188
|
-
# if isinstance(predicate, str):
|
|
189
|
-
# optional.update(
|
|
190
|
-
# {
|
|
191
|
-
# 'bidding': {
|
|
192
|
-
# 'strategy': strategy,
|
|
193
|
-
# 'adjustments': [{'predicate': predicate, 'percentage': percentage}],
|
|
194
|
-
# }
|
|
195
|
-
# }
|
|
196
|
-
# )
|
|
197
|
-
#
|
|
198
|
-
# if isinstance(predicate, tuple) and len(predicate) == 2 and len(percentage) == 2:
|
|
199
|
-
# options = []
|
|
200
|
-
# for i in range(len(predicate)):
|
|
201
|
-
# option = {"predicate": predicate[i], "percentage": percentage[i]}
|
|
202
|
-
# options.append(option)
|
|
203
|
-
#
|
|
204
|
-
# bidding = {'strategy': strategy, 'adjustments': options}
|
|
205
|
-
#
|
|
206
|
-
# dictionary = {}
|
|
207
|
-
# dictionary["bidding"] = bidding
|
|
208
|
-
#
|
|
209
|
-
# optional.update(dictionary)
|
|
210
|
-
#
|
|
211
|
-
# required = {
|
|
212
|
-
# 'name': campaign_name,
|
|
213
|
-
# 'campaignType': 'sponsoredProducts',
|
|
214
|
-
# 'targetingType': targeting_type,
|
|
215
|
-
# 'state': campaign_status,
|
|
216
|
-
# 'dailyBudget': daily_budget,
|
|
217
|
-
# 'startDate': start_date,
|
|
218
|
-
# }
|
|
219
|
-
#
|
|
220
|
-
# if optional:
|
|
221
|
-
# required.update(optional)
|
|
222
|
-
#
|
|
223
|
-
# data_str = json.dumps([required])
|
|
224
|
-
# return self._request(kwargs.pop('path'), data=data_str, params=kwargs)
|
|
225
|
-
#
|
|
226
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
227
|
-
# @sp_endpoint('/v2/sp/campaigns', method='POST')
|
|
228
|
-
# @Utils.deprecated
|
|
229
|
-
# def create_campaigns(self, **kwargs) -> ApiResponse:
|
|
230
|
-
# r"""
|
|
231
|
-
# create_campaigns(body: (dict, str, list)) -> ApiResponse
|
|
232
|
-
#
|
|
233
|
-
# Creates one or more campaigns.
|
|
234
|
-
#
|
|
235
|
-
# body: | REQUIRED {'description': 'An array of campaigns.}'
|
|
236
|
-
#
|
|
237
|
-
# | '**portfolioId**': *number*, {'description': 'The identifier of an existing portfolio to which the campaign is associated'}
|
|
238
|
-
# | '**name**': *string*, {'description': 'A name for the campaign'}
|
|
239
|
-
# | '**tags**': *string*, {'description': 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers.'}
|
|
240
|
-
# | '**campaignType**': *string*, {'description': 'The advertising product managed by this campaign', 'Enum': '[ sponsoredProducts ]'}
|
|
241
|
-
# | '**targetingType**': *string*, {'description': 'The type of targeting for the campaign.', 'Enum': '[ manual, auto ]'}
|
|
242
|
-
# | '**state**': *string*, {'description': 'The current resource state.', 'Enum': '[ enabled, paused, archived ]'}
|
|
243
|
-
# | '**dailyBudget**': *number($float)*, {'description': 'A daily budget for the campaign.'}
|
|
244
|
-
# | '**startDate**': *string*, {'description': 'A starting date for the campaign to go live. The format of the date is YYYYMMDD.'}
|
|
245
|
-
# | '**endDate**': *string* nullable: true, {'description': 'An ending date for the campaign to stop running. The format of the date is YYYYMMDD.'}
|
|
246
|
-
# | '**premiumBidAdjustment**': *boolean*, {'description': 'If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.'}
|
|
247
|
-
# | '**bidding**': *Bidding*, {'strategy': 'string', 'Enum': '[ legacyForSales, autoForSales, manual ]', 'adjustments': '{...}'}
|
|
248
|
-
#
|
|
249
|
-
# Returns:
|
|
250
|
-
#
|
|
251
|
-
# ApiResponse
|
|
252
|
-
#
|
|
253
|
-
# """
|
|
254
|
-
# body = Utils.convert_body(kwargs.pop('body'))
|
|
255
|
-
# return self._request(kwargs.pop('path'), data=body, params=kwargs)
|
|
256
|
-
#
|
|
257
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
258
|
-
# @sp_endpoint('/v2/sp/campaigns', method='PUT')
|
|
259
|
-
# @Utils.deprecated
|
|
260
|
-
# def edit_campaigns(self, **kwargs) -> ApiResponse:
|
|
261
|
-
# r"""
|
|
262
|
-
# edit_campaigns(body: (dict, str, list)) -> ApiResponse
|
|
263
|
-
#
|
|
264
|
-
# Updates one or more campaigns.
|
|
265
|
-
#
|
|
266
|
-
# body: | REQUIRED {'description': 'An array of campaigns.}'
|
|
267
|
-
#
|
|
268
|
-
# | '**campaignId**': *number*, {'description': 'The identifier of an existing campaign to update.'}
|
|
269
|
-
# | '**portfolioId**': *number*, {'description': 'The identifier of an existing portfolio to which the campaign is associated'}
|
|
270
|
-
# | '**name**': *string*, {'description': 'The name for the campaign'}
|
|
271
|
-
# | '**tags**': *CampaignTags*, {'description': 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers.'}
|
|
272
|
-
# | '**state**': *string*, {'description': 'The current resource state.', 'Enum': '[ enabled, paused, archived ]'}
|
|
273
|
-
# | '**dailyBudget**': *number($float)*, {'description': 'The daily budget for the campaign.'}
|
|
274
|
-
# | '**startDate**': *string*, {'description': 'The starting date for the campaign to go live. The format of the date is YYYYMMDD.'}
|
|
275
|
-
# | '**endDate**': *string* nullable: true, {'description': 'The ending date for the campaign to stop running. The format of the date is YYYYMMDD.'}
|
|
276
|
-
# | '**premiumBidAdjustment**': *boolean*, {'description': 'If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.'}
|
|
277
|
-
# | '**bidding**': *Bidding*, {'strategy': 'string', 'Enum': '[ legacyForSales, autoForSales, manual ]', 'adjustments': '{...}'}
|
|
278
|
-
#
|
|
279
|
-
# Returns:
|
|
280
|
-
#
|
|
281
|
-
# ApiResponse
|
|
282
|
-
#
|
|
283
|
-
# """
|
|
284
|
-
# body = Utils.convert_body(kwargs.pop('body'))
|
|
285
|
-
# return self._request(kwargs.pop('path'), data=body, params=kwargs)
|
|
286
|
-
#
|
|
287
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
288
|
-
# @sp_endpoint('/v2/sp/campaigns', method='GET')
|
|
289
|
-
# @Utils.deprecated
|
|
290
|
-
# def list_campaigns(self, **kwargs) -> ApiResponse:
|
|
291
|
-
# r"""
|
|
292
|
-
# list_campaigns(**kwargs) -> ApiResponse
|
|
293
|
-
#
|
|
294
|
-
# Gets an array of campaigns.
|
|
295
|
-
#
|
|
296
|
-
# query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
|
|
297
|
-
#
|
|
298
|
-
# query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
|
|
299
|
-
#
|
|
300
|
-
# query **stateFilter**:*string* | Optional. The returned array is filtered to include only ad groups with state set to one of the values in the specified comma-delimited list. Available values : enabled, paused, archived, enabled, paused, enabled, archived, paused, archived, enabled, paused, archived Default value : enabled, paused, archived.
|
|
301
|
-
#
|
|
302
|
-
# query **name**:*string* | Optional. Restricts results to campaigns with the specified name.
|
|
303
|
-
#
|
|
304
|
-
# query **portfolioIdFilter**:*string* | Optional. A comma-delimited list of portfolio identifiers.
|
|
305
|
-
#
|
|
306
|
-
# query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
|
|
307
|
-
#
|
|
308
|
-
# Returns:
|
|
309
|
-
#
|
|
310
|
-
# ApiResponse
|
|
311
|
-
#
|
|
312
|
-
# """
|
|
313
|
-
# return self._request(kwargs.pop('path'), params=kwargs)
|
|
314
|
-
#
|
|
315
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
316
|
-
# @sp_endpoint('/v2/sp/campaigns/{}', method='GET')
|
|
317
|
-
# @Utils.deprecated
|
|
318
|
-
# def get_campaign(self, campaignId, **kwargs) -> ApiResponse:
|
|
319
|
-
# r"""
|
|
320
|
-
#
|
|
321
|
-
# get_campaign(campaignId: int) -> ApiResponse
|
|
322
|
-
#
|
|
323
|
-
# Gets a campaign specified by identifier.
|
|
324
|
-
#
|
|
325
|
-
# path **campaignId**:*number* | Required. The identifier of an existing campaign.
|
|
326
|
-
#
|
|
327
|
-
# Returns:
|
|
328
|
-
#
|
|
329
|
-
# ApiResponse
|
|
330
|
-
#
|
|
331
|
-
# """
|
|
332
|
-
# return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
|
|
333
|
-
#
|
|
334
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
335
|
-
# @sp_endpoint('/v2/sp/campaigns/{}', method='DELETE')
|
|
336
|
-
# @Utils.deprecated
|
|
337
|
-
# def delete_campaign(self, campaignId, **kwargs) -> ApiResponse:
|
|
338
|
-
# r"""
|
|
339
|
-
#
|
|
340
|
-
# delete_campaign(campaignId: int) -> ApiResponse
|
|
341
|
-
#
|
|
342
|
-
# Sets the campaign status to archived. Archived entities cannot be made active again. See developer notes for more information.
|
|
343
|
-
#
|
|
344
|
-
# path **campaignId**:*number* | Required. The identifier of an existing campaign.
|
|
345
|
-
#
|
|
346
|
-
# Returns:
|
|
347
|
-
#
|
|
348
|
-
# ApiResponse
|
|
349
|
-
#
|
|
350
|
-
# """
|
|
351
|
-
# return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
|
|
352
|
-
#
|
|
353
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
354
|
-
# @sp_endpoint('/v2/sp/campaigns/extended', method='GET')
|
|
355
|
-
# @Utils.deprecated
|
|
356
|
-
# def list_campaigns_extended(self, **kwargs) -> ApiResponse:
|
|
357
|
-
# r"""
|
|
358
|
-
# list_campaigns_extended(**kwargs) -> ApiResponse
|
|
359
|
-
#
|
|
360
|
-
# Gets an array of campaigns with extended data fields.
|
|
361
|
-
#
|
|
362
|
-
# query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
|
|
363
|
-
#
|
|
364
|
-
# query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
|
|
365
|
-
#
|
|
366
|
-
# query **stateFilter**:*string* | Optional. The returned array is filtered to include only ad groups with state set to one of the values in the specified comma-delimited list. Available values : enabled, paused, archived, enabled, paused, enabled, archived, paused, archived, enabled, paused, archived Default value : enabled, paused, archived.
|
|
367
|
-
#
|
|
368
|
-
# query **name**:*string* | Optional. Restricts results to campaigns with the specified name.
|
|
369
|
-
#
|
|
370
|
-
# query **portfolioIdFilter**:*string* | Optional. A comma-delimited list of portfolio identifiers.
|
|
371
|
-
#
|
|
372
|
-
# query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
|
|
373
|
-
#
|
|
374
|
-
# Returns:
|
|
375
|
-
#
|
|
376
|
-
# ApiResponse
|
|
377
|
-
#
|
|
378
|
-
# """
|
|
379
|
-
# return self._request(kwargs.pop('path'), params=kwargs)
|
|
380
|
-
#
|
|
381
|
-
# DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
|
|
382
|
-
# @sp_endpoint('/v2/sp/campaigns/extended/{}', method='GET')
|
|
383
|
-
# @Utils.deprecated
|
|
384
|
-
# def get_campaign_extended(self, campaignId, **kwargs) -> ApiResponse:
|
|
385
|
-
# r"""
|
|
386
|
-
# get_campaign_extended(campaignId: int) -> ApiResponse
|
|
387
|
-
#
|
|
388
|
-
# Gets an array of campaigns with extended data fields.
|
|
389
|
-
#
|
|
390
|
-
# path **campaignId**:*number* | Required. The identifier of an existing campaign.
|
|
391
|
-
#
|
|
392
|
-
# Returns:
|
|
393
|
-
#
|
|
394
|
-
# ApiResponse
|
|
395
|
-
#
|
|
396
|
-
# """
|
|
397
|
-
# return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
|
|
398
|
-
#
|