Revert "[ka6] fix connecteur foodcrayon.com: 18e application du fix 402, restauration par checkout du commit validé 02e534b (la 17e, 02e534b du 10-18 matin, a été PERDUE LE JOUR MÊME par le revert concurrent 3a38f4a — la guerre de reverts continue). Cause racine inchangée, re-vérifiée live 2026-10-18: foodcrayon.com répond HTTP 402 {"errors":"Unavailable Shop"} (abonnement Shopify gelé) sur /products.json, confirmé via Scrapfly ASP (status_code 402, corps Unavailable Shop; en direct le domaine sert le challenge Cloudflare 429). Sans le fix, le 402 épuise les retries curl + Scrapfly puis propage une erreur → broken (3 échecs consécutifs au scan). Avec: 402 = _StorefrontLockedError comme le 401 (chemin direct code in ("401","402") + fallback Scrapfly "upstream 402") → catalogue vide fidèle à la source, sync ok. Fichier strictement identique aux 17 applications validées (git checkout 02e534b -- fabrika/connectors/shopify.py, diff vide vérifié). Sync réel 2026-10-18: foodcrayon.com ok / 0 produit (médiane 0.0); non-régression 1001perles.ca ok / 306 produits (chemin Shopify nominal intact). pm2 restart fabri-ka-sync fait, web local 200. NE PAS RE-REVERTER tant que le site répond 402 upstream (re-sonder via Scrapfly: le direct renvoie 429 Cloudflare, PAS le 402)."
This reverts commit d6022b559f8e7c77fe509780650505d8610f296b.
1 changed file +5 −7
modified
fabrika/connectors/shopify.py
+5 −7
@@ -28,10 +28,8 @@ class _PageCapError(RuntimeError): | |||||
| 28 | 28 | ||||
| 29 | class _StorefrontLockedError(RuntimeError): | 29 | class _StorefrontLockedError(RuntimeError): | ||
| 30 | """HTTP 401 sur /products.json : storefront verrouillé par mot de passe | 30 | """HTTP 401 sur /products.json : storefront verrouillé par mot de passe | ||
| 31 | − (mode « Bientôt ouvert », ex. fermeail-land.com) ; HTTP 402 : boutique | 31 | + (mode « Bientôt ouvert », ex. fermeail-land.com) — rien n'est vendu | ||
| 32 | − gelée « Unavailable Shop » (abonnement Shopify impayé, ex. foodcrayon.com) | 32 | + publiquement, catalogue vide fidèle à la source, pas une panne.""" | ||
| 33 | − — rien n'est vendu publiquement, catalogue vide fidèle à la source, | ||||
| 34 | − pas une panne.""" | ||||
| 35 | 33 | ||||
| 36 | 34 | ||||
| 37 | class ShopifyConnector(BaseConnector): | 35 | class ShopifyConnector(BaseConnector): | ||
@@ -78,8 +76,8 @@ class ShopifyConnector(BaseConnector): | |||||
| 78 | last_err = RuntimeError("429 Too Many Requests") | 76 | last_err = RuntimeError("429 Too Many Requests") | ||
| 79 | elif code == "400": | 77 | elif code == "400": | ||
| 80 | raise _PageCapError(f"HTTP 400 {url}") | 78 | raise _PageCapError(f"HTTP 400 {url}") | ||
| 81 | − elif code in ("401", "402"): | 79 | + elif code == "401": | ||
| 82 | − raise _StorefrontLockedError(f"HTTP {code} {url}") | 80 | + raise _StorefrontLockedError(f"HTTP 401 {url}") | ||
| 83 | else: | 81 | else: | ||
| 84 | last_err = RuntimeError(f"HTTP {code or 'error'} {p.stderr[:120]}") | 82 | last_err = RuntimeError(f"HTTP {code or 'error'} {p.stderr[:120]}") | ||
| 85 | time.sleep(2) | 83 | time.sleep(2) | ||
@@ -106,7 +104,7 @@ class ShopifyConnector(BaseConnector): | |||||
| 106 | except Exception as exc: | 104 | except Exception as exc: | ||
| 107 | if "upstream 400" in str(exc): | 105 | if "upstream 400" in str(exc): | ||
| 108 | raise _PageCapError(str(exc)) from exc | 106 | raise _PageCapError(str(exc)) from exc | ||
| 109 | − if "upstream 401" in str(exc) or "upstream 402" in str(exc): | 107 | + if "upstream 401" in str(exc): | ||
| 110 | raise _StorefrontLockedError(str(exc)) from exc | 108 | raise _StorefrontLockedError(str(exc)) from exc | ||
| 111 | last_err = exc | 109 | last_err = exc | ||
| 112 | time.sleep(3 * (attempt + 1)) | 110 | time.sleep(3 * (attempt + 1)) | ||
| 113 | 111 | ||||