SPB Git

Repository Public

giant_tiger.py 5.0 KB 126 lines python

1# =============================================================================2#                  SP BOUCHER | SOFTWARE & RESEARCH3#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project          : Food·Ka9# File             : foodka/connectors/giant_tiger.py10# Module           : foodka11# Repository       : https://git.spboucher.ai/food-ka12# Created          : 2026-08-1213# Last Modified    : 2026-08-1214#15# =============================================================================16# AUTHOR & PROFESSIONAL AFFILIATION17# =============================================================================18#19# Author           : Simon-Pierre Boucher20# Position         : Professor of Finance21# Institution      : Université du Québec en Outaouais (UQO)22# Department       : Département des sciences administratives23# Organization     : SP Boucher24#25# Website          : https://spboucher.ai26# Git              : https://git.spboucher.ai27#28# =============================================================================29# OFFICIAL CONTACT DIRECTORY30# =============================================================================31#32# General          : info@spboucher.ai33# Professional     : contact@spboucher.ai34# Direct           : simon@spboucher.ai35# Research         : research@spboucher.ai36# Development      : dev@spboucher.ai37# Support          : support@spboucher.ai38# Security/Admin   : admin@spboucher.ai39# Notifications    : notifications@spboucher.ai40#41# Preferred Contact: contact@spboucher.ai42#43# =============================================================================44# COPYRIGHT & INTELLECTUAL PROPERTY45# =============================================================================46#47# Copyright (c) 202648# Simon-Pierre Boucher49#50# All rights reserved where applicable.51#52# This file is governed by the applicable project license,53# copyright notices, institutional agreements and relevant law.54#55# Unless expressly authorized by the applicable license or56# rights holder, copying, redistribution, sublicensing,57# publication and commercial exploitation are not permitted.58#59# Existing third-party rights and notices remain unaffected.60#61# =============================================================================62# CONFIDENTIALITY & SECURITY63# =============================================================================64#65# Classification   : Public66# Distribution     : Public repository; use is governed by the project license67# Security Contact : admin@spboucher.ai68#69# Access to this source does not independently grant permission70# to redistribute or disclose confidential materials.71#72# Do not embed credentials, private keys, access tokens,73# certificates or confidential personal information.74#75# =============================================================================76# LICENSE & MAINTENANCE77# =============================================================================78#79# License          : None specified (no license file in this repository)80# Maintainer       : Simon-Pierre Boucher81# Technical Contact: dev@spboucher.ai82#83# =============================================================================84# END OF SP BOUCHER SOURCE HEADER85# =============================================================================8687# -----------------------------------------------------------------------------88# Food-Ka — connecteur Giant Tiger (magasin escompte, rayons épicerie)89# Auteur : Simon-Pierre Boucher — contact@spboucher.ai90# Boutique Shopify -> le catalogue complet mêle vêtements et articles de91# maison ; on cible donc les collections « épicerie » (voir _shopify.py).92# -----------------------------------------------------------------------------93from ..schema import Product94from ._shopify import ShopifyConnector9596# product_type Giant Tiger que normalize_category ne reconnaît pas97_TYPE_MAP = {98    "non-perishable": "Garde-manger",99    "fish": "Poissons et fruits de mer",100}101102103class GiantTigerConnector(ShopifyConnector):104    source_id = "giant_tiger"105    domain = "www.gianttiger.com"106107    # collections épicerie du site ; "" = déduire la catégorie du product_type108    collections = [109        ("grocery", ""),110        ("frozen", "Surgelés"),111        ("dairy-and-eggs", "Produits laitiers et œufs"),112        ("meat-and-seafood", "Viandes et volailles"),113        ("drinks-1", "Boissons"),114        ("chocolate-and-candy", "Collations et confiseries"),115        ("granola-bars-and-snacks", "Collations et confiseries"),116        ("international-food", "Garde-manger"),117        ("baby-food", "Bébé"),118    ]119120    def _to_product(self, product: dict, category: str = "") -> Product | None:121        # rabat les product_type maison ("Non-Perishable", "Fish"…) que la122        # normalisation générique ne connaît pas123        if not category:124            category = _TYPE_MAP.get((product.get("product_type") or "").lower(), "")125        return super()._to_product(product, category)126
Files main
Menu

Theme