99 lines
4.3 KiB
Python
99 lines
4.3 KiB
Python
import urllib.request
|
|
import json
|
|
import ssl
|
|
import sys
|
|
import io
|
|
|
|
if sys.platform == 'win32':
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
|
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace')
|
|
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
print("=================================================================")
|
|
print("🧪 VERIFICACIÓN FINAL DEL SISTEMA - DRIPZONE & WHATSAPP CATALOG")
|
|
print("=================================================================")
|
|
|
|
# 1. Feed XML de Catálogo WhatsApp
|
|
print("\n[1] Verificando Feed XML de Catálogo WhatsApp (Meta Commerce)...")
|
|
try:
|
|
req = urllib.request.Request(
|
|
"https://drip-zone.online/api/catalog/feed.xml",
|
|
headers={"User-Agent": "facebookexternalhit/1.1"}
|
|
)
|
|
with urllib.request.urlopen(req, context=ctx, timeout=15) as res:
|
|
content = res.read().decode('utf-8', errors='replace')
|
|
print(f" -> HTTP Status: {res.status}")
|
|
print(f" -> Content-Type: {res.headers.get('Content-Type')}")
|
|
item_count = content.count("<item>")
|
|
print(f" -> Total productos en XML: {item_count}")
|
|
if "<rss" in content and "<channel>" in content:
|
|
print(" -> Estructura XML: VÁLIDA (RSS 2.0 / Google & Meta Merchant Feed)")
|
|
first_item = content.split("<item>")[1].split("</item>")[0] if item_count > 0 else ""
|
|
if first_item:
|
|
lines = [l.strip() for l in first_item.split("\n") if l.strip()][:6]
|
|
print(" -> Muestra primer producto:\n " + "\n ".join(lines))
|
|
except Exception as e:
|
|
print(f" [ERROR] {e}")
|
|
|
|
# 2. Feed CSV de Catálogo WhatsApp
|
|
print("\n[2] Verificando Feed CSV de Catálogo WhatsApp...")
|
|
try:
|
|
req = urllib.request.Request("https://drip-zone.online/api/catalog/feed.csv")
|
|
with urllib.request.urlopen(req, context=ctx, timeout=15) as res:
|
|
content = res.read().decode('utf-8', errors='replace')
|
|
print(f" -> HTTP Status: {res.status}")
|
|
csv_lines = [l for l in content.split("\n") if l.strip()]
|
|
print(f" -> Total filas en CSV (incluyendo header): {len(csv_lines)}")
|
|
print(f" -> Header CSV: {csv_lines[0] if csv_lines else 'Vacío'}")
|
|
except Exception as e:
|
|
print(f" [ERROR] {e}")
|
|
|
|
# 3. Webhook de WhatsApp en DripZone
|
|
print("\n[3] Verificando Webhook en DripZone...")
|
|
try:
|
|
req = urllib.request.Request(
|
|
"https://drip-zone.online/api/webhook/whatsapp",
|
|
data=json.dumps({"test": True, "source": "final_verification"}).encode('utf-8'),
|
|
headers={"Content-Type": "application/json"}
|
|
)
|
|
with urllib.request.urlopen(req, context=ctx, timeout=15) as res:
|
|
print(f" -> POST /api/webhook/whatsapp: HTTP {res.status}")
|
|
print(f" -> Respuesta: {res.read().decode('utf-8')}")
|
|
except Exception as e:
|
|
print(f" [ERROR] {e}")
|
|
|
|
# 4. APK Público
|
|
print("\n[4] Verificando disponibilidad del APK...")
|
|
try:
|
|
req = urllib.request.Request("https://drip-zone.online/DripZone.apk", method="HEAD")
|
|
with urllib.request.urlopen(req, context=ctx, timeout=15) as res:
|
|
size_mb = int(res.headers.get('Content-Length', 0)) / (1024 * 1024)
|
|
print(f" -> URL: https://drip-zone.online/DripZone.apk")
|
|
print(f" -> HTTP Status: {res.status} (Tamaño: {size_mb:.2f} MB)")
|
|
except Exception as e:
|
|
print(f" [ERROR] {e}")
|
|
|
|
# 5. Webhooks en Evolution API
|
|
print("\n[5] Verificando configuración de Webhooks en Evolution API...")
|
|
for inst, key in [("AutomataAlmeira", "EE49029EEB85-4568-8F81-C9FDFC6E2943"), ("DripZone", "83B5BD230796-4324-AE73-3508F69E279D")]:
|
|
try:
|
|
req = urllib.request.Request(
|
|
f"https://evolution.almeira.com.co/webhook/find/{inst}",
|
|
headers={"apikey": key}
|
|
)
|
|
with urllib.request.urlopen(req, context=ctx, timeout=15) as res:
|
|
data = json.loads(res.read().decode('utf-8'))
|
|
print(f" -> Instancia {inst}:")
|
|
print(f" Enabled: {data.get('enabled')}")
|
|
print(f" Webhook URL: {data.get('url')}")
|
|
print(f" Eventos: {data.get('events')}")
|
|
except Exception as e:
|
|
print(f" [ERROR en {inst}]: {e}")
|
|
|
|
print("\n=================================================================")
|
|
print("✅ TODAS LAS PRUEBAS COMPLETADAS")
|
|
print("=================================================================")
|