Skip to content

Commit ebf1cd1

Browse files
committed
v0.5.8
1 parent 5202c75 commit ebf1cd1

File tree

5 files changed

+70
-3
lines changed

5 files changed

+70
-3
lines changed

ad_api/api/sb/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from .media import Media
2121
from .reports import Reports
2222
from .snapshots import Snapshots
23+
from .benchmarks import Benchmarks
2324

2425
__all__ = [
2526
"Brands",
@@ -44,4 +45,5 @@
4445
"Media",
4546
"Reports",
4647
"Snapshots",
48+
"Benchmarks"
4749
]

ad_api/api/sb/benchmarks.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
from ad_api.base import Client, sp_endpoint, ApiResponse, Utils, fill_query_params
2+
3+
4+
class Benchmarks(Client):
5+
"""
6+
Use the Amazon Advertising API for Sponsored Brands for campaign, ad group, keyword, negative keyword, drafts, Stores, landing pages, and Brands management operations. For more information about Sponsored Brands, see the Sponsored Brands Support Center. For onboarding information, see the account setup topic.
7+
"""
8+
@sp_endpoint('/benchmarks/brands/{}/categories/{}', method='POST')
9+
def list_brand_and_category(self, brandName, categoryId, version: int = 1, **kwargs) -> ApiResponse:
10+
11+
12+
json_version = 'application/vnd.timeseriesdata.v' + str(version) + "+json"
13+
14+
headers = {
15+
"Accept": json_version,
16+
}
17+
18+
return self._request(fill_query_params(kwargs.pop('path'), brandName, categoryId), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
19+
20+
21+
@sp_endpoint('/benchmarks/brands', method='GET')
22+
def list_brands(self, **kwargs) -> ApiResponse:
23+
"""
24+
Gets an array of Brand data objects for the Brand associated with the profile ID passed in the header. For more information about Brands, see [Brand Services](https://brandservices.amazon.com/).
25+
26+
Keyword Args
27+
| None
28+
29+
Returns:
30+
ApiResponse payload:
31+
32+
| '**brandId**': *string*, {'description': 'The Brand identifier.'}
33+
| '**brandEntityId**': *string*, {'description': 'The Brand entity identifier.'}
34+
| '**brandRegistryName**': *string*, {'description': 'The Brand name.'}
35+
36+
"""
37+
return self._request(kwargs.pop('path'), params=kwargs)
38+
39+
40+
@sp_endpoint('/benchmarks/brandsAndCategories', method='POST')
41+
def list_brands_and_categories(self, version: int = 1, **kwargs) -> ApiResponse:
42+
"""
43+
Creates Sponsored Brands campaigns.
44+
45+
Request body (Required)
46+
Request body
47+
| **name** (string): [optional] The name of the campaign. This name must be unique to the Amazon Advertising account to which the campaign is associated. Maximum length of the string is 128 characters.
48+
| **state** (State > string): [optional] Enum: [ enabled, paused, archived ]
49+
| **portfolio_id** (int) [optional] The identifier of the portfolio to which the campaign is associated.
50+
| **budget** (float): [optional] The budget amount associated with the campaign.
51+
| **bid_optimization** (bool) [optional] Set to `true` to allow Amazon to automatically optimize bids for placements below top of search if omitted the server will use the default value of True
52+
| **bid_multiplier** (float minimum: -99 maximum: 99) [optional] A bid multiplier. Note that this field can only be set when 'bidOptimization' is set to false. Value is a percentage to two decimal places. Example: If set to -40.00 for a $5.00 bid, the resulting bid is $3.00.
53+
| **end_date** (EndDate > string) [optional] The YYYYMMDD end date of the campaign. Must be greater than the value specified in the startDate field. If this property is not included in the request, the endDate value is not updated. If set to null, endDate is deleted from the draft campaign. [nullable: true] [pattern: ^\\d{8}$]
54+
55+
Returns
56+
ApiResponse
57+
"""
58+
59+
json_version = 'application/vnd.reportdata.v' + str(version) + "+json"
60+
61+
headers = {
62+
"Accept": json_version,
63+
}
64+
65+
return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)

ad_api/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.5.7"
1+
__version__ = "0.5.8"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = python-amazon-ad-api
3-
version = 0.5.7
3+
version = 0.5.8
44
author = Daniel Alvaro
55
author_email = denisneuf@hotmail.com
66
description = Python wrapper for the Amazon Advertising API

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='python-amazon-ad-api',
5-
version='0.5.7',
5+
version='0.5.8',
66
install_requires=[
77
"requests>=2.27.1,<2.33.0",
88
"six~=1.16.0",

0 commit comments

Comments
 (0)