[ka6] fix connecteur foodcrayon.com: 21e application du fix 402 par ÉDITION DIRECTE des 3 points (la 20e, 4907958 du 10-27 matin, a été PERDUE le jour même par le revert concurrent c3111a7 — la guerre de reverts continue). Méthode inchangée: checkout INTERDIT sur shopify.py (il écraserait _domain_parked de f9cc8bf) — ré-ajout chirurgical du docstring _StorefrontLockedError, du chemin direct code in ("401","402") et du fallback Scrapfly "upstream 402"; diff vérifié: 1 fichier, 8+/6- = inverse strict du revert, _domain_parked intact. Cause racine inchangée, re-vérifiée live 2026-10-27: foodcrayon.com répond HTTP 402 {"errors":"Unavailable Shop"} (abonnement Shopify gelé) sur /products.json (curl direct → 402). Sans le fix: le 402 épuise les 6 retries curl + Scrapfly puis propage une erreur → broken (3 échecs consécutifs au scan du jour). Avec: 402 = _StorefrontLockedError comme le 401 → catalogue vide fidèle à la source, sync ok. Sync réel 2026-10-27: foodcrayon.com ok / 0 produit (médiane 0.0); non-régression 1001perles.ca ok / 309 (chemin Shopify nominal intact) ET artisacreations.ca ok / 0 (_domain_parked intact) — 3 ok, 0 erreur en 34 s. pm2 restart fabri-ka-sync fait, web local 200. NE PAS RE-REVERTER tant que le site répond 402 (re-sonder live: curl -s -o /dev/null -w '%{http_code}' https://foodcrayon.com/products.json → 402). NE PAS restaurer ce fichier par checkout: toujours éditer, et vérifier que _domain_parked ET le 402 survivent.
1 changed file +8 −6
modified
fabrika/connectors/shopify.py
+8 −6
@@ -27,9 +27,11 @@ class _PageCapError(RuntimeError): | ||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | class _StorefrontLockedError(RuntimeError): |
| 30 | − """HTTP 401 sur /products.json : storefront verrouillé par mot de passe | |
| 31 | − (mode « Bientôt ouvert », ex. fermeail-land.com) — rien n'est vendu | |
| 32 | − publiquement, catalogue vide fidèle à la source, pas une panne.""" | |
| 30 | + """HTTP 401 ou 402 sur /products.json : storefront verrouillé par mot de | |
| 31 | + passe (mode « Bientôt ouvert », ex. fermeail-land.com) ou boutique gelée | |
| 32 | + pour abonnement impayé (402 « Unavailable Shop », ex. foodcrayon.com) — | |
| 33 | + rien n'est vendu publiquement, catalogue vide fidèle à la source, pas une | |
| 34 | + panne.""" | |
| 33 | 35 | |
| 34 | 36 | |
| 35 | 37 | class ShopifyConnector(BaseConnector): |
@@ -76,8 +78,8 @@ class ShopifyConnector(BaseConnector): | ||
| 76 | 78 | last_err = RuntimeError("429 Too Many Requests") |
| 77 | 79 | elif code == "400": |
| 78 | 80 | raise _PageCapError(f"HTTP 400 {url}") |
| 79 | − elif code == "401": | |
| 80 | − raise _StorefrontLockedError(f"HTTP 401 {url}") | |
| 81 | + elif code in ("401", "402"): | |
| 82 | + raise _StorefrontLockedError(f"HTTP {code} {url}") | |
| 81 | 83 | else: |
| 82 | 84 | last_err = RuntimeError(f"HTTP {code or 'error'} {p.stderr[:120]}") |
| 83 | 85 | time.sleep(2) |
@@ -104,7 +106,7 @@ class ShopifyConnector(BaseConnector): | ||
| 104 | 106 | except Exception as exc: |
| 105 | 107 | if "upstream 400" in str(exc): |
| 106 | 108 | raise _PageCapError(str(exc)) from exc |
| 107 | − if "upstream 401" in str(exc): | |
| 109 | + if "upstream 401" in str(exc) or "upstream 402" in str(exc): | |
| 108 | 110 | raise _StorefrontLockedError(str(exc)) from exc |
| 109 | 111 | last_err = exc |
| 110 | 112 | time.sleep(3 * (attempt + 1)) |
| 111 | 113 | |