python-amazon-ad-api 2.3.0__py3-none-any.whl → 2.3.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.
@@ -0,0 +1,121 @@
1
+ """Record management /v2/dp.
2
+
3
+ Contract: Amazon Ads API for Data Providers 3.0, the *Record management* child
4
+ of *Data provider*. Four routes under ``/v2/dp``: audience metadata CRUD and the
5
+ two ``PATCH`` routes that add or remove audiences and users.
6
+
7
+ The contract asks for no identity header. It lists only ``Authorization``,
8
+ ``Amazon-Advertising-API-ClientId`` and ``Content-Type``, so the decorators carry
9
+ ``headers=[]`` and neither a profile nor an account travels: the
10
+ ``advertiserId`` goes inside the body.
11
+ """
12
+
13
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
14
+
15
+
16
+ class RecordManagement(Client):
17
+ r"""Record management - /v2/dp
18
+
19
+ Documentation: https://advertising.amazon.com/API/docs/en-us/data-provider/openapi
20
+ """
21
+
22
+ @sp_endpoint('/v2/dp/audiencemetadata/', method='POST', headers=[])
23
+ def create_audience_metadata(self, **kwargs) -> ApiResponse:
24
+ r"""
25
+ Creates audience metadata for a data provider.
26
+
27
+ Request Body [Required]
28
+ The audience metadata the contract publishes: its name and the
29
+ advertiser it belongs to.
30
+
31
+ Returns
32
+ ApiResponse with the created metadata.
33
+ """
34
+ headers = {'Accept': 'application/json',
35
+ 'Content-Type': 'application/json'}
36
+ body = Utils.convert_body(kwargs.pop('body'), False)
37
+ return self._request(fill_query_params(kwargs.pop('path')),
38
+ data=body, params=kwargs, headers=headers)
39
+
40
+ @sp_endpoint('/v2/dp/audiencemetadata/{}', method='PUT', headers=[])
41
+ def update_audience_metadata(self, audienceId, **kwargs) -> ApiResponse:
42
+ r"""
43
+ Updates audience metadata.
44
+
45
+ Path Parameters
46
+
47
+ - ``audienceId`` (int): the audience, an int64. [required]
48
+
49
+ Request Body [Required]
50
+ The metadata to replace.
51
+
52
+ Returns
53
+ ApiResponse with the metadata.
54
+ """
55
+ headers = {'Accept': 'application/json',
56
+ 'Content-Type': 'application/json'}
57
+ body = Utils.convert_body(kwargs.pop('body'), False)
58
+ return self._request(fill_query_params(kwargs.pop('path'), audienceId),
59
+ data=body, params=kwargs, headers=headers)
60
+
61
+ @sp_endpoint('/v2/dp/audiencemetadata/{}', method='GET', headers=[])
62
+ def get_audience_metadata(self, audienceId, **kwargs) -> ApiResponse:
63
+ r"""
64
+ Reads audience metadata. Read only.
65
+
66
+ Path Parameters
67
+
68
+ - ``audienceId`` (int): the audience, an int64. [required]
69
+
70
+ Returns
71
+ ApiResponse with the metadata. An unknown id answers ``404`` with
72
+ ``The audienceId is not found``, naming the field.
73
+ """
74
+ headers = {'Accept': 'application/json'}
75
+ return self._request(fill_query_params(kwargs.pop('path'), audienceId),
76
+ params=kwargs, headers=headers)
77
+
78
+ @sp_endpoint('/v2/dp/audience', method='PATCH', headers=[])
79
+ def patch_audience(self, **kwargs) -> ApiResponse:
80
+ r"""
81
+ Adds or removes audiences on records.
82
+
83
+ Request Body [Required]
84
+ | **patches** (list): each entry carries ``op`` (``add`` or
85
+ | ``remove``), ``path`` in the form
86
+ | ``/<recordIdType>-<recordIdValue>/audiences``, and the values.
87
+
88
+ Returns
89
+ ApiResponse with the outcome.
90
+ """
91
+ headers = {'Accept': 'application/json',
92
+ 'Content-Type': 'application/json'}
93
+ body = Utils.convert_body(kwargs.pop('body'), False)
94
+ return self._request(fill_query_params(kwargs.pop('path')),
95
+ data=body, params=kwargs, headers=headers)
96
+
97
+ @sp_endpoint('/v2/dp/users', method='PATCH', headers=[])
98
+ def patch_users(self, **kwargs) -> ApiResponse:
99
+ r"""
100
+ Adds or removes users, with the audiences and advertiser each one
101
+ belongs to.
102
+
103
+ Request Body [Required]
104
+ | **users** (list): each entry carries ``userId`` as an object with
105
+ | ``type`` (``COOKIE``, ``MAID`` or ``EXTERNAL_USER_ID``) and
106
+ | ``value``, plus its ``advertiserId`` and audiences.
107
+
108
+ Returns
109
+ ApiResponse with the outcome.
110
+
111
+ Note
112
+ This route spells the client header
113
+ ``Amazon-Advertising-API-ClientID`` with ``ID`` in capitals while
114
+ its siblings use ``ClientId``. HTTP header names are
115
+ case-insensitive, so the one the client sends works.
116
+ """
117
+ headers = {'Accept': 'application/json',
118
+ 'Content-Type': 'application/json'}
119
+ body = Utils.convert_body(kwargs.pop('body'), False)
120
+ return self._request(fill_query_params(kwargs.pop('path')),
121
+ data=body, params=kwargs, headers=headers)
@@ -0,0 +1,89 @@
1
+ """Targetable entities /targetableEntities.
2
+
3
+ Contract: Targetable Entities 3.0. Two ``POST`` routes sharing one media type,
4
+ ``application/vnd.Mindreader.TargetableEntitiesResource.v<n>+json``, for the same
5
+ body and the same answer. It is the first child of *Discovery*, next to
6
+ *Locations*.
7
+
8
+ The contract lists ``Amazon-Advertising-API-ClientId`` as required and both
9
+ ``Amazon-Advertising-API-Scope`` and ``Amazon-Advertising-AccountId``, without
10
+ the ``-API-`` in the name, as optional. The scope is what identifies the
11
+ account here.
12
+ """
13
+
14
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
15
+
16
+
17
+ class TargetableEntities(Client):
18
+ r"""Targetable entities - /targetableEntities
19
+
20
+ Documentation: https://advertising.amazon.com/API/docs/en-us/targetable-entities
21
+ """
22
+
23
+ @sp_endpoint('/targetableEntities/list', method='POST',
24
+ headers=['Amazon-Advertising-API-Scope'])
25
+ def list_targetable_entities(self, version: str = "1", **kwargs) -> ApiResponse:
26
+ r"""
27
+ Lists the audiences, categories and category audiences one can target
28
+ with a given ad product. Read only.
29
+
30
+ Request Body, all optional
31
+ | **adProduct** (str): ``SPONSORED_BRANDS``, ``SPONSORED_DISPLAY``,
32
+ | ``SPONSORED_PRODUCTS`` or ``SPONSORED_TELEVISION``.
33
+ | **locale** (str): underscore form, such as ``es_ES``. This family
34
+ | is not hyphenated, unlike moderation.
35
+ | **maxResults** (int): from 1 to 250.
36
+ | **nextToken** (str): token from a previous answer.
37
+ | **parentBrowseNodeIdFilter** (list): up to 1000 parent browse node
38
+ | ids.
39
+ | **pathsFilter** (list of lists): each inner list is one path
40
+ | hierarchy, such as ``[["Audience Category"]]``.
41
+
42
+ Keyword Args
43
+
44
+ - ``version`` (str): media type version. Defaults to ``1``. [optional]
45
+
46
+ Returns
47
+ ApiResponse with ``targetableEntities`` and ``nextToken``. Each
48
+ entry carries ``targetType`` (``AUDIENCE``, ``CONTENT_CATEGORY``,
49
+ ``PRODUCT_CATEGORY`` or ``PRODUCT_CATEGORY_AUDIENCE``), ``path``,
50
+ the display name and, for an audience, its ``audienceId`` and the
51
+ tooltip the UI shows.
52
+ """
53
+ media_type = ('application/vnd.Mindreader.TargetableEntitiesResource.v'
54
+ + version + '+json')
55
+ headers = {'Accept': media_type, 'Content-Type': media_type}
56
+ body = Utils.convert_body(kwargs.pop('body'), False)
57
+ return self._request(fill_query_params(kwargs.pop('path')),
58
+ data=body, params=kwargs, headers=headers)
59
+
60
+ @sp_endpoint('/targetableEntities/paths/list', method='POST',
61
+ headers=['Amazon-Advertising-API-Scope'])
62
+ def list_targetable_entity_paths(self, version: str = "1", **kwargs) -> ApiResponse:
63
+ r"""
64
+ Walks the category tree and returns the children of the paths given.
65
+ Read only.
66
+
67
+ Request Body [Required]
68
+ | **adProduct** (str): the same enum as the list.
69
+
70
+ Request Body [Optional]
71
+ | **locale** (str): underscore form, such as ``es_ES``.
72
+ | **pathsFilter** (list of lists): up to ten paths, each of up to
73
+ | ten levels, such as ``[["Audience Category"]]``.
74
+
75
+ Keyword Args
76
+
77
+ - ``version`` (str): media type version. Defaults to ``1``. [optional]
78
+
79
+ Returns
80
+ ApiResponse with ``paths``, a list of paths, and ``totalResults``.
81
+ An unknown entry answers ``200`` with ``paths: []`` and
82
+ ``totalResults: 0``, which is not an error.
83
+ """
84
+ media_type = ('application/vnd.Mindreader.TargetableEntitiesResource.v'
85
+ + version + '+json')
86
+ headers = {'Accept': media_type, 'Content-Type': media_type}
87
+ body = Utils.convert_body(kwargs.pop('body'), False)
88
+ return self._request(fill_query_params(kwargs.pop('path')),
89
+ data=body, params=kwargs, headers=headers)
ad_api/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.3.0"
1
+ __version__ = "2.3.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-amazon-ad-api
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Python wrapper for the Amazon Advertising API
5
5
  Home-page: https://github.com/denisneuf/python-amazon-ad-api
6
6
  Author: Daniel Alvaro
@@ -1,6 +1,6 @@
1
1
  ad_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- ad_api/version.py,sha256=CpK8IH_dCUAwg9tqv7zm9FxbBFkxCnED1JUiRe7cftU,22
3
- ad_api/api/__init__.py,sha256=lZhbjQDYX0Um0t9BUzdh81-BXSZycBhY-okXUIBqTq4,2714
2
+ ad_api/version.py,sha256=neZxeMmEfjhVZM6xetRikrBdHWt5T5ehL72ZYdPtJ-E,22
3
+ ad_api/api/__init__.py,sha256=j_tpYAc9Lf_YGZbe8gokZVdaBoqQVF0XL3r0Rb8g9-I,3143
4
4
  ad_api/api/account.py,sha256=jNYwfjW8b0HhqP7PjlMev55aXJP3YIuqWhrxri0Pk4Y,4673
5
5
  ad_api/api/account_budgets.py,sha256=jFce5eLWAFK3ydjnYR7_Sv7B0-gHTG5bMTx_TcHyy1A,2319
6
6
  ad_api/api/ad_library.py,sha256=nlTMHhqinZF5QKWtXngmwA8reTnG5ChIwQVCs_URUIk,3270
@@ -14,20 +14,25 @@ ad_api/api/billing.py,sha256=C_lFVdnymX3V9bg865Bf5f5DMm31IROxvJNYPhvoR7c,29322
14
14
  ad_api/api/brand_benchmarks.py,sha256=ht5EMvGeIb7MA8U2HfQtOj818T6JxM9nEY_HtsBo2H0,3280
15
15
  ad_api/api/brand_home.py,sha256=IaKKsw2lo5vsmMHs1-tZviHx63t8_cfRFDyWstS-qME,5618
16
16
  ad_api/api/brand_metrics.py,sha256=zEOSPffq8j-2vAz_z77EcKU2sa9i1WzzBqswTmoL5yA,9321
17
- ad_api/api/campaign_diagnostics.py,sha256=XejATbNZpUyWWyOKMRJAGbh4ny755tiTWWfrWlr-kDM,2502
17
+ ad_api/api/campaign_diagnostics.py,sha256=3yoAhaHzYgoPqJ3aA88DVyI6-4VECUxy1KEkoMkqRhM,2508
18
18
  ad_api/api/creative_assets.py,sha256=u0bCnioUFpGOQO5Z_MO0ErSLcAgSZB5GWM5wm2oW6L0,9687
19
19
  ad_api/api/dsp_advertiser.py,sha256=ztSr0s15Z9scQNKElWxRujexsENn84MT-ihNhijLi_M,1427
20
20
  ad_api/api/eligibility.py,sha256=3hKloUciUZ4CplJkaHvrteUEuhv37-sVrQUYnfIMuZU,3824
21
21
  ad_api/api/exports.py,sha256=nHUIn-iQKAL5XS2IW5xwYs8ZbHmk1rutpmfPz7O2UvY,7968
22
+ ad_api/api/forecast.py,sha256=EwEb71lK7xPEmxzvw-_-VqRx6ZQ73vwX8xYjL6IP5Oc,5582
23
+ ad_api/api/hashed_records.py,sha256=2n-fVSPicw_CTzvFDSfI4Fn-Gnr0WLR8AzLUysONbE8,1518
24
+ ad_api/api/historic_reach.py,sha256=7qwVkYxq42M-Mq3wGaXc8IfO31r-8XZes4I6TqJok-8,6306
22
25
  ad_api/api/history.py,sha256=RUUC7e5QttAKhUWXSocDdfPr0K0nQBUWTaCPhDJoE0A,2610
23
26
  ad_api/api/insights.py,sha256=nO_jGPy3B9gXk6lm8coD90fil8pk1GmMxuos_67CcJk,2440
24
27
  ad_api/api/localization.py,sha256=HdkChAawloJ8zj5rCye9NVf7kLnQ7vW6aKsBLZ2W-gI,17158
28
+ ad_api/api/locations.py,sha256=MH12Obg7IlYM76h3_JA61hD_qRhNc2I5SbJorq-zJOE,2549
25
29
  ad_api/api/manager_accounts.py,sha256=bzuv__9tthuV0tuKh7Qk2d5GQYwljISL6zwmVU50rNI,5155
26
30
  ad_api/api/marketing_mix_modeling.py,sha256=Sup5afxUgpzpr9IcCOWw0xmWB5L0W14048Me9gG4HC8,8554
27
31
  ad_api/api/metadata.py,sha256=v-06G_EFmCWA9v4WorEPtIlbLOaYnv-veboXZi95WUo,2472
28
32
  ad_api/api/moderation.py,sha256=Wv3sQqbBQfiV7OcaUbRf8WqeMz0Cyz7AY7eXh4L_FuA,2855
29
33
  ad_api/api/partner_opportunities.py,sha256=NGTUc5rVuxOHQ4Dm8eZuHWi1AlYNq3z-2Y42mA-JBkM,7807
30
34
  ad_api/api/persona_builder.py,sha256=-sqs-XJb9sFjuM6S1eTQnEgsNQLp5ubuAi_qR3_y_E4,8677
35
+ ad_api/api/plan_management.py,sha256=PB5lETbW1HPxK1-TGopmv66XDbzbf0S905UIxrJ8w6U,52178
31
36
  ad_api/api/portfolios.py,sha256=Oe3LS2HsjMJSq1Id8cwOWrH2AiPMcBb7oTkFHjudnTI,7103
32
37
  ad_api/api/portfolios_v3.py,sha256=wSV9XYmdsvUaqLNGLy6NvUTRJJmxGNMO7PMig2zT41c,7608
33
38
  ad_api/api/pre_moderation.py,sha256=VHcG9j6ubqzQU-Pqwr-2l_fUn8XadZVw46HzwBBV85c,3052
@@ -35,9 +40,11 @@ ad_api/api/profiles.py,sha256=g8u3tD7i8DHZ8dKN3cBM-dNLDLeqh8ctXXWlLpw1Arw,4851
35
40
  ad_api/api/ras_campaign_management.py,sha256=PeUF_W48iIAU1qoE0XWnW7OWYlpOp7iAdvR-OFoQdiY,20676
36
41
  ad_api/api/ras_retailer_identity.py,sha256=RobQLsLv9lF29ZDr5KwAQoh5skJ_Ono2CBmaSabCRm0,2067
37
42
  ad_api/api/recommendations.py,sha256=dV9uB8_hmylObZINvUetahc-tL4DBX0s9XMhYLkYFYE,6324
43
+ ad_api/api/record_management.py,sha256=5ZRGYLR2nZcjHcyErAJXOQpENguWUGHzCkvftIWZtPs,4825
38
44
  ad_api/api/reports.py,sha256=u9mYkWOYSBVf8N1NyEc7pxUS04xzberGsCffTHKkFTA,8140
39
45
  ad_api/api/stores.py,sha256=BiwqOldK9zEsNjQzcII1DgBxQkDNsGP20aBx5i5Dmg8,2709
40
46
  ad_api/api/stream.py,sha256=Ga1VHOR_z2YAZY3kRhDvzwEDad3P260g1lWfc4OAjGk,9338
47
+ ad_api/api/targetable_entities.py,sha256=bbdayyuYOnu1r4FutfmNcT23OtuAa0S_Rws59Z2uQVI,4075
41
48
  ad_api/api/validation_configurations.py,sha256=Qaxy_J67Fqw0ecS4f1sK9lGdiOLsq323RXeZO0_2KV0,4092
42
49
  ad_api/api/sb/__init__.py,sha256=APbCAkWM1gzYuhpEUU98XDIKJKJx1NXALjLBXA9zdBU,1538
43
50
  ad_api/api/sb/ad_creatives_v4.py,sha256=zQzTivDkGzX3I5ZfCWIlzRUGWfTRsXJZCKQrKMaMDpc,14512
@@ -154,8 +161,8 @@ ad_api/base/marketplaces.py,sha256=44lvCcluXNpqTprWQ80e3weSQmQbJoWL-WDSOWVbCyQ,4
154
161
  ad_api/base/utils.py,sha256=_qnCBOvyJTLgaZjJzUWTi38GGLHkQszXELs79133Rb4,5618
155
162
  ad_api/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
156
163
  ad_api/shared/base_client.py,sha256=zOL_LTh-58URWf3ZDlrwmqXXbd6PX66QF5hrr2p83yY,356
157
- python_amazon_ad_api-2.3.0.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
158
- python_amazon_ad_api-2.3.0.dist-info/METADATA,sha256=bFjlVHOwyU899xX1yC2Y33dUG0flP1nTBJbx8llMJw8,10678
159
- python_amazon_ad_api-2.3.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
160
- python_amazon_ad_api-2.3.0.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
161
- python_amazon_ad_api-2.3.0.dist-info/RECORD,,
164
+ python_amazon_ad_api-2.3.1.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
165
+ python_amazon_ad_api-2.3.1.dist-info/METADATA,sha256=h-lylLM4G66Zo1gi-TIwRtiJox4lNicvbMWNAKkaLGQ,10678
166
+ python_amazon_ad_api-2.3.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
167
+ python_amazon_ad_api-2.3.1.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
168
+ python_amazon_ad_api-2.3.1.dist-info/RECORD,,