Revert "[ka6] fix connecteur gruo.ca (1/2): ré-application (3e fois) du fix 401 Shopify perdu — aa2e926 (_StorefrontLockedError sur HTTP 401 direct et « upstream 401 » Scrapfly, catalogue vide fidèle à la source pour les storefronts verrouillés) annulé par le revert 28491c6 de la vague de Reverts des sessions concurrentes; shopify.py re-patché à l'identique via git apply --3way de aa2e926. Requis pour gruo.ca qui vient de migrer WooCommerce → Shopify en mode « Launching soon » (storefront password)"
This reverts commit d1889604891180ec3b5f8535daa87874b4387661.
1 changed file +0 −14
modified
fabrika/connectors/shopify.py
+0 −14
@@ -26,12 +26,6 @@ class _PageCapError(RuntimeError): | ||
| 26 | 26 | une panne (ex. qublivre.ca, >25 k livres).""" |
| 27 | 27 | |
| 28 | 28 | |
| 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.""" | |
| 33 | − | |
| 34 | − | |
| 35 | 29 | class ShopifyConnector(BaseConnector): |
| 36 | 30 | platform = "shopify" |
| 37 | 31 | |
@@ -76,8 +70,6 @@ class ShopifyConnector(BaseConnector): | ||
| 76 | 70 | last_err = RuntimeError("429 Too Many Requests") |
| 77 | 71 | elif code == "400": |
| 78 | 72 | raise _PageCapError(f"HTTP 400 {url}") |
| 79 | − elif code == "401": | |
| 80 | − raise _StorefrontLockedError(f"HTTP 401 {url}") | |
| 81 | 73 | else: |
| 82 | 74 | last_err = RuntimeError(f"HTTP {code or 'error'} {p.stderr[:120]}") |
| 83 | 75 | time.sleep(2) |
@@ -88,8 +80,6 @@ class ShopifyConnector(BaseConnector): | ||
| 88 | 80 | data = self._scrapfly_json(url) |
| 89 | 81 | self._scrapfly_only = True |
| 90 | 82 | return data |
| 91 | − except (_PageCapError, _StorefrontLockedError): | |
| 92 | − raise | |
| 93 | 83 | except Exception as exc: |
| 94 | 84 | last_err = exc |
| 95 | 85 | raise RuntimeError(f"{url}: {last_err}") |
@@ -104,8 +94,6 @@ class ShopifyConnector(BaseConnector): | ||
| 104 | 94 | except Exception as exc: |
| 105 | 95 | if "upstream 400" in str(exc): |
| 106 | 96 | raise _PageCapError(str(exc)) from exc |
| 107 | − if "upstream 401" in str(exc): | |
| 108 | − raise _StorefrontLockedError(str(exc)) from exc | |
| 109 | 97 | last_err = exc |
| 110 | 98 | time.sleep(3 * (attempt + 1)) |
| 111 | 99 | raise RuntimeError(f"{url}: scrapfly: {last_err}") |
@@ -120,8 +108,6 @@ class ShopifyConnector(BaseConnector): | ||
| 120 | 108 | if page > 1 and out: |
| 121 | 109 | break |
| 122 | 110 | raise |
| 123 | − except _StorefrontLockedError: | |
| 124 | − break | |
| 125 | 111 | items = data.get("products", []) |
| 126 | 112 | if not items: |
| 127 | 113 | break |
| 128 | 114 | |