From b1f3ef0d2859c8f4a030aa5ceed756ece43fe1c3 Mon Sep 17 00:00:00 2001 From: denisneuf Date: Fri, 23 Feb 2024 18:25:46 +0800 Subject: [PATCH] v0.5.6 --- ad_api/api/__init__.py | 2 ++ ad_api/api/stores.py | 32 ++++++++++++++++++++++++++++++++ ad_api/version.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 ad_api/api/stores.py diff --git a/ad_api/api/__init__.py b/ad_api/api/__init__.py index 7f0356e..3e43630 100644 --- a/ad_api/api/__init__.py +++ b/ad_api/api/__init__.py @@ -21,6 +21,7 @@ from .recommendations import Recommendations from .stream import Stream from .exports import Exports +from .stores import Stores __all__ = [ "sp", @@ -49,4 +50,5 @@ "Recommendations", "Stream", "Exports", + "Stores" ] diff --git a/ad_api/api/stores.py b/ad_api/api/stores.py new file mode 100644 index 0000000..630ad7d --- /dev/null +++ b/ad_api/api/stores.py @@ -0,0 +1,32 @@ +from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils + + +class Stores(Client): + """ + Brand Metrics provides a new measurement solution that quantifies opportunities for your brand at each stage of the customer journey on Amazon, and helps brands understand the value of different shopping engagements that impact stages of that journey. You can now access Awareness and Consideration indices that compare your performance to peers using models predictive of consideration and sales. Brand Metrics quantifies the number of customers in the awareness and consideration marketing funnel stages and is built at scale to measure all shopping engagements with your brand on Amazon, not just ad-attributed engagements. Additionally, BM breaks out key shopping engagements at each stage of the shopping journey, along with the Return on Engagement, so you can measure the historical sales following a consideration event or purchase. + """ + + @sp_endpoint('/stores/{}/asinMetrics', method='POST') + def get_asin_engagement_for_store(self, brandEntityId, version: int = 1, **kwargs) -> ApiResponse: + r""" + getAsinEngagementForStore + """ + content_type = 'application/vnd.GetAsinEngagementForStoreRequest.v'+ str(version) +'+json' + accept = 'application/vnd.GetAsinEngagementForStoreResponse.v'+ str(version) +'+json' + headers = {'Content-Type': content_type, 'Accept': accept} + return self._request(fill_query_params(kwargs.pop('path'), brandEntityId), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers) + + @sp_endpoint('/stores/{}/insights', method='GET') + def get_insights_for_store_api(self, brandEntityId, version: int = 1, **kwargs) -> ApiResponse: + r""" + getInsightsForStoreAPI + """ + content_type = 'application/vnd.GetInsightsForStoreRequest.v'+ str(version) +'+json' + # accept = 'application/vnd.GetInsightsForStoreResponse.v'+ str(version) +'+json' + # headers = {'Content-Type': content_type, 'Accept': accept} + return self._request(fill_query_params(kwargs.pop('path'), brandEntityId), + data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs) + # return self._request(fill_query_params(kwargs.pop('path'), brandEntityId), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers) + + + diff --git a/ad_api/version.py b/ad_api/version.py index 86716a7..a779a44 100644 --- a/ad_api/version.py +++ b/ad_api/version.py @@ -1 +1 @@ -__version__ = "0.5.5" +__version__ = "0.5.6" diff --git a/setup.cfg b/setup.cfg index c7e1f68..11c966c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = python-amazon-ad-api -version = 0.5.5 +version = 0.5.6 author = Daniel Alvaro author_email = denisneuf@hotmail.com description = Python wrapper for the Amazon Advertising API diff --git a/setup.py b/setup.py index c43c92d..1415475 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='python-amazon-ad-api', - version='0.5.5', + version='0.5.6', install_requires=[ "requests>=2.27.1,<2.32.0", "six~=1.16.0",