feat: strip MTZ internal suffix from descriptions
Removes trailing " (NNNNN) - Country - Npcs ByBox" pattern from product descriptions before serving to BC. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
4
main.py
4
main.py
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import requests
|
import requests
|
||||||
@@ -86,11 +87,12 @@ def download_and_parse():
|
|||||||
brand_raw = row[9] # col J
|
brand_raw = row[9] # col J
|
||||||
brand = str(brand_raw) if brand_raw is not None else ""
|
brand = str(brand_raw) if brand_raw is not None else ""
|
||||||
min_box_raw = row[10] # col K
|
min_box_raw = row[10] # col K
|
||||||
|
description = re.sub(r'\s*\(\d+\).*$', '', str(row[2] or "")).strip()
|
||||||
parsed.append(
|
parsed.append(
|
||||||
{
|
{
|
||||||
"item_code": safe_int(row[1], 0),
|
"item_code": safe_int(row[1], 0),
|
||||||
"ean": ean,
|
"ean": ean,
|
||||||
"description": str(row[2] or ""),
|
"description": description,
|
||||||
"price_usd": safe_float(row[4], 0.0),
|
"price_usd": safe_float(row[4], 0.0),
|
||||||
"stock": safe_int(row[5], 0),
|
"stock": safe_int(row[5], 0),
|
||||||
"brand": brand,
|
"brand": brand,
|
||||||
|
|||||||
Reference in New Issue
Block a user