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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amazon-ads-cli
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: CLI tool for Amazon Advertising API v3
5
5
  Home-page: https://github.com/stellaraether/amazon-ads-cli
6
6
  Author: Lunan Li
@@ -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."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amazon-ads-cli
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: CLI tool for Amazon Advertising API v3
5
5
  Home-page: https://github.com/stellaraether/amazon-ads-cli
6
6
  Author: Lunan Li
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name="amazon-ads-cli",
5
- version="0.1.4",
5
+ version="0.1.6",
6
6
  description="CLI tool for Amazon Advertising API v3",
7
7
  author="Lunan Li",
8
8
  author_email="lunan@stellaraether.com",
File without changes
File without changes
File without changes