Edit file File name : delete_select_product.py Content :import sys from google.oauth2 import service_account from googleapiclient.discovery import build from googleapiclient.errors import HttpError # === Config === SERVICE_ACCOUNT_FILE = './keys/quicklly-merchant-center.json' SCOPES = ['https://www.googleapis.com/auth/content'] merchant_id = '5616033984' # === Auth === credentials = service_account.Credentials.from_service_account_file( SERVICE_ACCOUNT_FILE, scopes=SCOPES ) service = build('content', 'v2.1', credentials=credentials) # === Check CLI args === if len(sys.argv) != 2: print("Usage: python delete_product.py <offerId>") sys.exit(1) offer_id = sys.argv[1] product_id = f'online:en:US:{offer_id}' # === Delete Product === try: service.products().delete( merchantId=merchant_id, productId=product_id ).execute() print(f"[Success] Deleted product {product_id}") except HttpError as e: if e.resp.status == 404: print(f"[Not Found] Product {product_id} does not exist.") else: print(f"[Error] HTTP error while deleting {product_id}: {e}") except Exception as e: print(f"[Error] Unexpected error: {e}") Save