[ka6] fix connecteur foodcrayon.com: la boutique est passée de « storefront password » (401, déjà géré) à « Store unavailable » (402, abonnement Shopify gelé) — le 402 épuisait 6 retries curl + 3 Scrapfly puis propageait une erreur. Le 402 est maintenant traité comme le 401 (_StorefrontLockedError, direct + fallback Scrapfly): catalogue vide fidèle à la source, sync ok. Sync réel: 1 ok / 0 erreur / 0 produit (= médiane historique 0.0, zéro légitime); non-régression vérifiée sur lulobaceramics.ca (56 produits, 0 erreur)
1 changed file +7 −5
modified
fabrika/connectors/shopify.py
+7 −5
@@ -28,8 +28,10 @@ class _PageCapError(RuntimeError): | ||
| 28 | 28 | |
| 29 | 29 | class _StorefrontLockedError(RuntimeError): |
| 30 | 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.""" | |
| 31 | + (mode « Bientôt ouvert », ex. fermeail-land.com), ou HTTP 402 : boutique | |
| 32 | + gelée par Shopify pour abonnement impayé (« Store unavailable », | |
| 33 | + ex. foodcrayon.com) — rien n'est vendu publiquement, catalogue vide | |
| 34 | + fidèle à la source, pas une 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 | |