44 lines
1.3 KiB
Python
Executable File
44 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Test rapide du parser Backmarket avec la fixture."""
|
|
|
|
from pricewatch.app.stores.backmarket.store import BackmarketStore
|
|
|
|
# Charger la fixture
|
|
with open("scraped/backmarket_pw.html", "r", encoding="utf-8") as f:
|
|
html = f.read()
|
|
|
|
url = "https://www.backmarket.fr/fr-fr/p/iphone-15-pro"
|
|
|
|
store = BackmarketStore()
|
|
snapshot = store.parse(html, url)
|
|
|
|
print("=" * 80)
|
|
print("TEST PARSER BACKMARKET")
|
|
print("=" * 80)
|
|
|
|
print(f"\nSource: {snapshot.source}")
|
|
print(f"URL: {snapshot.url}")
|
|
print(f"Reference: {snapshot.reference}")
|
|
print(f"Title: {snapshot.title}")
|
|
print(f"Price: {snapshot.price} {snapshot.currency}")
|
|
print(f"Stock: {snapshot.stock_status}")
|
|
print(f"Images: {len(snapshot.images)} images")
|
|
for i, img in enumerate(snapshot.images[:3]):
|
|
print(f" [{i+1}] {img[:80]}")
|
|
print(f"Category: {snapshot.category}")
|
|
print(f"Specs: {len(snapshot.specs)} specs")
|
|
for key, value in list(snapshot.specs.items())[:5]:
|
|
print(f" - {key}: {value}")
|
|
|
|
print(f"\nDebug status: {snapshot.debug.status}")
|
|
print(f"Debug errors: {len(snapshot.debug.errors)}")
|
|
for err in snapshot.debug.errors:
|
|
print(f" - {err}")
|
|
|
|
print(f"Debug notes: {len(snapshot.debug.notes)}")
|
|
for note in snapshot.debug.notes:
|
|
print(f" - {note}")
|
|
|
|
print(f"\nIs complete: {snapshot.is_complete()}")
|
|
print("=" * 80)
|