mcm-cli 1.7.0__py3-none-any.whl → 1.7.2__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.
- {mcm_cli-1.7.0.dist-info → mcm_cli-1.7.2.dist-info}/METADATA +1 -1
- {mcm_cli-1.7.0.dist-info → mcm_cli-1.7.2.dist-info}/RECORD +10 -10
- mcmcli/__main__.py +1 -1
- mcmcli/command/admin.py +18 -3
- mcmcli/command/decision.py +7 -2
- {mcm_cli-1.7.0.dist-info → mcm_cli-1.7.2.dist-info}/LICENSE +0 -0
- {mcm_cli-1.7.0.dist-info → mcm_cli-1.7.2.dist-info}/NOTICE +0 -0
- {mcm_cli-1.7.0.dist-info → mcm_cli-1.7.2.dist-info}/WHEEL +0 -0
- {mcm_cli-1.7.0.dist-info → mcm_cli-1.7.2.dist-info}/entry_points.txt +0 -0
- {mcm_cli-1.7.0.dist-info → mcm_cli-1.7.2.dist-info}/top_level.txt +0 -0
@@ -1,13 +1,13 @@
|
|
1
1
|
mcmcli/__init__.py,sha256=-U6lMZ9_99IXAKwnqnYXYr6NcO6TSmG-kxewgvJjU4k,575
|
2
|
-
mcmcli/__main__.py,sha256=
|
2
|
+
mcmcli/__main__.py,sha256=9TwAzRDvQh2pqwvliq4mTlR6d2TZYpQ9rAgfBio8X7c,1844
|
3
3
|
mcmcli/logging.py,sha256=xjRS5ey1ONx_d34qB1Fetb_SwPysoh2hzNDuNAaYYWQ,1739
|
4
4
|
mcmcli/requests.py,sha256=IuySBQ8P_GoGF3f_TRysfgQNOhi2n9M84WK_eRXnoEU,2945
|
5
5
|
mcmcli/command/account.py,sha256=FWXmzOLj4rVLVLEv-w0eDVlQVrkONvR1UewZbcTDgE4,24994
|
6
|
-
mcmcli/command/admin.py,sha256=
|
6
|
+
mcmcli/command/admin.py,sha256=ynIWITIuLLUFDy2mqcKToLTsIwdNH4-k-6o-lWp1Rh0,19191
|
7
7
|
mcmcli/command/auth.py,sha256=Ak7ZNEskWPpMoeTJcbYlEpDBgzxn8N33Q2dNf67SsCs,2926
|
8
8
|
mcmcli/command/campaign.py,sha256=eHE_i1lRlUuU1GeVMwXkJgBU_zOgU-b9Wo0SYC9TK7M,15444
|
9
9
|
mcmcli/command/config.py,sha256=08C5ftAvdvpQ26Z329LqhP8AxTI629LS7Ou6glzrRgw,4396
|
10
|
-
mcmcli/command/decision.py,sha256=
|
10
|
+
mcmcli/command/decision.py,sha256=L54-Uw-CyXELOIGMv464fxjaSFKCgqJGEKXFjqBDFIg,9285
|
11
11
|
mcmcli/command/report.py,sha256=N8IMyDZ5QpY11-KkZG-n5_ZzEeh-ME5s2s3wrAKEGjY,5387
|
12
12
|
mcmcli/command/wallet.py,sha256=vG2rg7tPwGsV9YB7cpvkiocbqtB1reqXn7dmolFmzD4,11536
|
13
13
|
mcmcli/data/account.py,sha256=pe7tPapP6vlUD5D5L5Nh5k2bkWdYOK01Mpt5fBYFnJs,1782
|
@@ -23,10 +23,10 @@ mcmcli/data/seller.py,sha256=40SA7QekM3a3svDrDYLo_QYJ68VUxDO0KeGejJMp4k4,1004
|
|
23
23
|
mcmcli/data/token.py,sha256=11wtyLHCAZHu0LVbNDPa-yipcL6lenxoYIKEI58VzFs,1744
|
24
24
|
mcmcli/data/user_join_request.py,sha256=lXMO2hE_VpRg0JofVrYAVM82S-RLFkPrZk8-drvhoDI,1251
|
25
25
|
mcmcli/data/wallet.py,sha256=eMUi8N0vJdg_E10TPhSPoZkZtmIG7gHyqgabQ8C5Lg8,3217
|
26
|
-
mcm_cli-1.7.
|
27
|
-
mcm_cli-1.7.
|
28
|
-
mcm_cli-1.7.
|
29
|
-
mcm_cli-1.7.
|
30
|
-
mcm_cli-1.7.
|
31
|
-
mcm_cli-1.7.
|
32
|
-
mcm_cli-1.7.
|
26
|
+
mcm_cli-1.7.2.dist-info/LICENSE,sha256=RFhQPdSOiMTguUX7JSoIuTxA7HVzCbj_p8WU36HjUQQ,10947
|
27
|
+
mcm_cli-1.7.2.dist-info/METADATA,sha256=_XJUBVV7-FL_ErDmKJ5wLcvPiy3Zj9nFrN2bov-37RY,3056
|
28
|
+
mcm_cli-1.7.2.dist-info/NOTICE,sha256=Ldnl2MjRaXPxcldUdbI2NTybq60XAa2LowRhFrRTuiI,76
|
29
|
+
mcm_cli-1.7.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
30
|
+
mcm_cli-1.7.2.dist-info/entry_points.txt,sha256=qTHAWZ-ejSiU4t11RYwtAU8ScqhQPDeMVTG9y4wMVLg,60
|
31
|
+
mcm_cli-1.7.2.dist-info/top_level.txt,sha256=sh7oqIaqLQlMtKHlxHHgpV2xGMrBMPFWpSp0C6nvJ_Y,7
|
32
|
+
mcm_cli-1.7.2.dist-info/RECORD,,
|
mcmcli/__main__.py
CHANGED
@@ -37,7 +37,7 @@ def version():
|
|
37
37
|
"""
|
38
38
|
Show the tool version
|
39
39
|
"""
|
40
|
-
typer.echo(f"Version: mcm-cli v1.7.
|
40
|
+
typer.echo(f"Version: mcm-cli v1.7.2")
|
41
41
|
|
42
42
|
app.add_typer(mcmcli.command.account.app, name="account", help="Ad account management")
|
43
43
|
app.add_typer(mcmcli.command.admin.app, name="admin", help="Platform administration")
|
mcmcli/command/admin.py
CHANGED
@@ -77,6 +77,7 @@ def block_item(
|
|
77
77
|
@app.command()
|
78
78
|
def generate_sample_data(
|
79
79
|
ad_inventory_id: str = typer.Option(help="The ad inventory ID to use when calling the Decision API."),
|
80
|
+
search_query: str = typer.Option(None, help="The search keyword to use when calling the Decision API."),
|
80
81
|
num_iterations: int = typer.Option(100, help="How many times to call the Decision API."),
|
81
82
|
warn: bool = typer.Option(True, help="Shows a warning message before running. Use `--no-warn` if you want to skip the warning."),
|
82
83
|
profile: str = typer.Option("default", help="Profile Name – The MCM CLI configuration profile to use."),
|
@@ -86,7 +87,21 @@ def generate_sample_data(
|
|
86
87
|
and click trackers to generate sample data in the platform.
|
87
88
|
"""
|
88
89
|
if warn:
|
89
|
-
typer.confirm("
|
90
|
+
typer.confirm("""⚠️ WARNING: This script is strictly for use on the TEST platform.⚠️
|
91
|
+
Running it on any other platform may corrupt data or confuse the ML system.
|
92
|
+
It will generate sample impressions and clicks.
|
93
|
+
Please proceed only if you are certain.""", abort=True)
|
94
|
+
|
95
|
+
config = mcmcli.command.config.get_config(profile)
|
96
|
+
if (config is None):
|
97
|
+
print(f"ERROR: Failed to load the CLI profile", file=sys.stderr, flush=True)
|
98
|
+
sys.exit()
|
99
|
+
|
100
|
+
platform_id = config['platform_id']
|
101
|
+
if (not platform_id.endswith("_TEST")):
|
102
|
+
print(f"ERROR: The platform {platform_id} is not a TEST platform.", file=sys.stderr, flush=True)
|
103
|
+
sys.exit()
|
104
|
+
|
90
105
|
|
91
106
|
# Initialize DecisionCommand
|
92
107
|
d = mcmcli.command.decision.DecisionCommand(profile)
|
@@ -96,7 +111,7 @@ def generate_sample_data(
|
|
96
111
|
|
97
112
|
for i in range(num_iterations):
|
98
113
|
# Call Decision API to get trackers
|
99
|
-
_, error, decided_items = d.decide_items(ad_inventory_id)
|
114
|
+
_, error, decided_items = d.decide_items(ad_inventory_id, search_query)
|
100
115
|
if error:
|
101
116
|
print_error(f"Error calling Decision API: {error.message}")
|
102
117
|
continue
|
@@ -305,7 +320,7 @@ def list_platform_users(
|
|
305
320
|
print('User ID,Created At,Updated At,Status,Email,Name,Roles')
|
306
321
|
for u in users:
|
307
322
|
roles = [f'{x.name} of {x.resource_type} {x.resource_id}' for x in u.roles]
|
308
|
-
print(f'{u.id},{u.created_at},{u.updated_at},{u.status},{u.email},{u.name},{
|
323
|
+
print(f'{u.id},{u.created_at},{u.updated_at},{u.status},{u.email},{u.name},{";".join(roles)}')
|
309
324
|
|
310
325
|
@app.command()
|
311
326
|
def list_wallet_balances(
|
mcmcli/command/decision.py
CHANGED
@@ -32,6 +32,7 @@ app = typer.Typer(add_completion=False)
|
|
32
32
|
@app.command()
|
33
33
|
def decide_items(
|
34
34
|
inventory_id: str = typer.Option(help="Ad inventory ID"),
|
35
|
+
search_query: str = typer.Option(None, help="The search keyword to use when calling the Decision API."),
|
35
36
|
num_items: int = typer.Option(help="Number of items requested for the inventory."),
|
36
37
|
items: str = typer.Option(None, help="The main item ids of the page. For example, homepage inventories don't have any main items, and product-detail-page inventories have one main item."),
|
37
38
|
location_filter: str = typer.Option(None, help="Location filter value"),
|
@@ -43,7 +44,7 @@ def decide_items(
|
|
43
44
|
"""
|
44
45
|
d = DecisionCommand(profile)
|
45
46
|
|
46
|
-
curl, error, ret = d.decide_items(inventory_id, num_items, items, location_filter, to_curl)
|
47
|
+
curl, error, ret = d.decide_items(inventory_id, search_query, num_items, items, location_filter, to_curl)
|
47
48
|
if to_curl:
|
48
49
|
print(curl)
|
49
50
|
return
|
@@ -140,6 +141,7 @@ class DecisionCommand:
|
|
140
141
|
def decide_items(
|
141
142
|
self,
|
142
143
|
inventory_id,
|
144
|
+
search_query = None,
|
143
145
|
num_items = 5,
|
144
146
|
items = False,
|
145
147
|
location_filter = None,
|
@@ -151,7 +153,7 @@ class DecisionCommand:
|
|
151
153
|
]:
|
152
154
|
_api_url = f"{self.api_base_url}/auction"
|
153
155
|
_payload = {
|
154
|
-
"request_id": "request-
|
156
|
+
"request_id": f"mcmcli-request-{random.randint(100_000, 999_999)}",
|
155
157
|
"inventory": {
|
156
158
|
"inventory_id": inventory_id,
|
157
159
|
"num_items": num_items
|
@@ -166,6 +168,9 @@ class DecisionCommand:
|
|
166
168
|
if items:
|
167
169
|
_payload["inventory"]["items"] = items.split(',')
|
168
170
|
|
171
|
+
if search_query:
|
172
|
+
_payload["inventory"]["search_query"] = search_query
|
173
|
+
|
169
174
|
if location_filter:
|
170
175
|
_payload["filtering"] = {
|
171
176
|
"location": {
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|