Skip to content

Commit

Permalink
v0.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
denisneuf committed Sep 23, 2024
1 parent 5202c75 commit ebf1cd1
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ad_api/api/sb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .media import Media
from .reports import Reports
from .snapshots import Snapshots
from .benchmarks import Benchmarks

__all__ = [
"Brands",
Expand All @@ -44,4 +45,5 @@
"Media",
"Reports",
"Snapshots",
"Benchmarks"
]
65 changes: 65 additions & 0 deletions ad_api/api/sb/benchmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
from ad_api.base import Client, sp_endpoint, ApiResponse, Utils, fill_query_params


class Benchmarks(Client):
"""
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.
"""
@sp_endpoint('/benchmarks/brands/{}/categories/{}', method='POST')
def list_brand_and_category(self, brandName, categoryId, version: int = 1, **kwargs) -> ApiResponse:


json_version = 'application/vnd.timeseriesdata.v' + str(version) + "+json"

headers = {
"Accept": json_version,
}

return self._request(fill_query_params(kwargs.pop('path'), brandName, categoryId), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)


@sp_endpoint('/benchmarks/brands', method='GET')
def list_brands(self, **kwargs) -> ApiResponse:
"""
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/).
Keyword Args
| None
Returns:
ApiResponse payload:
| '**brandId**': *string*, {'description': 'The Brand identifier.'}
| '**brandEntityId**': *string*, {'description': 'The Brand entity identifier.'}
| '**brandRegistryName**': *string*, {'description': 'The Brand name.'}
"""
return self._request(kwargs.pop('path'), params=kwargs)


@sp_endpoint('/benchmarks/brandsAndCategories', method='POST')
def list_brands_and_categories(self, version: int = 1, **kwargs) -> ApiResponse:
"""
Creates Sponsored Brands campaigns.
Request body (Required)
Request body
| **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.
| **state** (State > string): [optional] Enum: [ enabled, paused, archived ]
| **portfolio_id** (int) [optional] The identifier of the portfolio to which the campaign is associated.
| **budget** (float): [optional] The budget amount associated with the campaign.
| **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
| **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.
| **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}$]
Returns
ApiResponse
"""

json_version = 'application/vnd.reportdata.v' + str(version) + "+json"

headers = {
"Accept": json_version,
}

return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
2 changes: 1 addition & 1 deletion ad_api/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.7"
__version__ = "0.5.8"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = python-amazon-ad-api
version = 0.5.7
version = 0.5.8
author = Daniel Alvaro
author_email = [email protected]
description = Python wrapper for the Amazon Advertising API
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='python-amazon-ad-api',
version='0.5.7',
version='0.5.8',
install_requires=[
"requests>=2.27.1,<2.33.0",
"six~=1.16.0",
Expand Down

0 comments on commit ebf1cd1

Please sign in to comment.