Analysis scripts to match GoMag orders with Oracle invoices by date/client/total, then compare line items by price to discover SKU → id_articol mappings. Generates SQL for nom_articole codmat updates and CSV for ARTICOLE_TERTI repackaging/set mappings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
import sys, json, httpx
|
|
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
|
|
API_URL = 'https://api.gomag.ro/api/v1/order/read/json'
|
|
headers = {
|
|
'Apikey': '4c5e46df8f6c4f054fe2787de7a13d4a',
|
|
'ApiShop': 'https://coffeepoint.ro',
|
|
'User-Agent': 'Mozilla/5.0',
|
|
'Content-Type': 'application/json',
|
|
}
|
|
|
|
target = sys.argv[1] if len(sys.argv) > 1 else '480700091'
|
|
|
|
for page in range(1, 20):
|
|
resp = httpx.get(API_URL, headers=headers, params={'startDate': '2026-03-08', 'page': page, 'limit': 250}, timeout=60)
|
|
data = resp.json()
|
|
orders = data.get('orders', {})
|
|
if isinstance(orders, dict) and target in orders:
|
|
print(json.dumps(orders[target], indent=2, ensure_ascii=False))
|
|
sys.exit(0)
|
|
# Also check by 'number' field
|
|
if isinstance(orders, dict):
|
|
for key, order in orders.items():
|
|
if isinstance(order, dict) and str(order.get('number', '')) == target:
|
|
print(json.dumps(order, indent=2, ensure_ascii=False))
|
|
sys.exit(0)
|
|
if page >= data.get('pages', 1):
|
|
break
|
|
|
|
print(f"Order {target} not found")
|