amazon-ads-cli 0.1.4__tar.gz → 0.1.6__tar.gz
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.
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/PKG-INFO +1 -1
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli/main.py +57 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli.egg-info/PKG-INFO +1 -1
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/setup.py +1 -1
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/LICENSE +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/README.md +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli/__init__.py +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli/__main__.py +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli.egg-info/SOURCES.txt +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli.egg-info/dependency_links.txt +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli.egg-info/entry_points.txt +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli.egg-info/requires.txt +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/amazon_ads_cli.egg-info/top_level.txt +0 -0
- {amazon_ads_cli-0.1.4 → amazon_ads_cli-0.1.6}/setup.cfg +0 -0
|
@@ -489,6 +489,63 @@ def list_all_targets(ctx):
|
|
|
489
489
|
click.echo(f"{camp_id:<20} {ag_id:<20} {expr:<40} {state}")
|
|
490
490
|
|
|
491
491
|
|
|
492
|
+
@targets.command("create")
|
|
493
|
+
@click.argument("campaign-id")
|
|
494
|
+
@click.argument("ad-group-id")
|
|
495
|
+
@click.argument("asin")
|
|
496
|
+
@click.option("--bid", default=1.0, help="Bid amount")
|
|
497
|
+
@click.pass_context
|
|
498
|
+
def create_target(ctx, campaign_id, ad_group_id, asin, bid):
|
|
499
|
+
"""Create an ASIN target in a campaign ad group."""
|
|
500
|
+
try:
|
|
501
|
+
result = sponsored_products.TargetsV3(
|
|
502
|
+
marketplace=Marketplaces.NA
|
|
503
|
+
).create_product_targets(
|
|
504
|
+
body={
|
|
505
|
+
"targetingClauses": [
|
|
506
|
+
{
|
|
507
|
+
"campaignId": campaign_id,
|
|
508
|
+
"adGroupId": ad_group_id,
|
|
509
|
+
"expression": [{"value": asin, "type": "ASIN_SAME_AS"}],
|
|
510
|
+
"expressionType": "MANUAL",
|
|
511
|
+
"state": "ENABLED",
|
|
512
|
+
"bid": bid,
|
|
513
|
+
}
|
|
514
|
+
]
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
success = result.payload.get("targetingClauses", {}).get("success", [])
|
|
518
|
+
errors = result.payload.get("targetingClauses", {}).get("error", [])
|
|
519
|
+
if success:
|
|
520
|
+
target_id = success[0].get("targetId")
|
|
521
|
+
click.echo(f"✅ Created ASIN target: {asin} (ID: {target_id}) - ${bid}")
|
|
522
|
+
elif errors:
|
|
523
|
+
msg = (
|
|
524
|
+
errors[0]
|
|
525
|
+
.get("errors", [{}])[0]
|
|
526
|
+
.get("errorValue", {})
|
|
527
|
+
.get("otherError", {})
|
|
528
|
+
.get("message", "Unknown error")
|
|
529
|
+
)
|
|
530
|
+
click.echo(f"❌ Error: {msg}")
|
|
531
|
+
except Exception as e:
|
|
532
|
+
click.echo(f"❌ Error: {e}")
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
@targets.command("delete")
|
|
536
|
+
@click.argument("target-id")
|
|
537
|
+
@click.pass_context
|
|
538
|
+
def delete_target(ctx, target_id):
|
|
539
|
+
"""Delete a product target by ID."""
|
|
540
|
+
try:
|
|
541
|
+
sponsored_products.TargetsV3(
|
|
542
|
+
marketplace=Marketplaces.NA
|
|
543
|
+
).delete_product_targets(body={"targetIdFilter": {"include": [target_id]}})
|
|
544
|
+
click.echo(f"✅ Deleted target: {target_id}")
|
|
545
|
+
except Exception as e:
|
|
546
|
+
click.echo(f"❌ Error: {e}")
|
|
547
|
+
|
|
548
|
+
|
|
492
549
|
@cli.group()
|
|
493
550
|
def report():
|
|
494
551
|
"""Report commands."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|