SPB Git

Repository Public

lac_jerome.py 5.9 KB 142 lines python

1# =============================================================================2#                  SP BOUCHER | SOFTWARE & RESEARCH3#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project          : Lou·Ka9# File             : louka/connectors/lac_jerome.py10# Module           : louka11# Repository       : https://git.spboucher.ai/lou-ka12# Created          : 2026-08-2513# Last Modified    : 2026-08-2514#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# Lou-Ka — Agrégateur de logements à louer (province de Québec)89# Auteur : Simon-Pierre Boucher — contact@spboucher.ai90# connectors/lac_jerome.py : connecteur Habitations du Lac Jérôme91#   (habitationsdulacjerome.com — 3 projets locatifs neufs à Saint-Jérôme :92#   Le Seize (condos), La Quaza (maisons et bachelors), Le Hexa (condos)).93#   Le site WordPress affiche ses unités via le widget Planpoint : on94#   interroge l'API JSON publique (app.planpoint.io/api/groups/find,95#   1 requête/sync, voir _planpoint.py). Granularité UNITÉ, AVEC prix96#   mensuel publié (1 900 $ à 2 800 $), pi², plans par unité, inclusions97#   françaises et date de livraison. Les projets Planpoint n'ont ni adresse98#   ni lat/lng ; chez La Quaza et Le Hexa le NOM de l'unité est une adresse99#   civique (« 113 Réal-Piché ») qu'on récupère comme adresse. Seules les100#   unités « Available » sont retenues.101# -----------------------------------------------------------------------------102from __future__ import annotations103104import re105106from ..schema import Listing107from ._planpoint import planpoint_projects, unit_listing108from .base import BaseConnector109110PAGE_URL = "https://habitationsdulacjerome.com/"111NAMESPACE = "habitations-du-lac-jerome"112HOST_NAME = "for-rent"113114# « 113 Réal-Piché » -> adresse civique (rue du projet à Saint-Jérôme)115_CIVIC_RE = re.compile(r"^\d+\s+[A-ZÀ-Ü]", re.U)116117118class LacJeromeConnector(BaseConnector):119    source_id = "lac_jerome"120    request_delay = 0.8121122    def fetch(self) -> list[Listing]:123        try:124            projects = planpoint_projects(self, "groups", NAMESPACE, HOST_NAME)125        except Exception:126            return []127        listings: list[Listing] = []128        for project in projects:129            for floor in project.get("floors") or []:130                for unit in floor.get("units") or []:131                    lst = unit_listing(self.source_id, project, floor, unit,132                                       page_url=PAGE_URL,133                                       default_city="Saint-Jérôme")134                    if lst is None:135                        continue136                    # adresse civique dans le nom d'unité (La Quaza, Le Hexa)137                    name = (unit.get("name") or "").strip()138                    if not lst.address and _CIVIC_RE.match(name):139                        lst.address = name140                    listings.append(lst)141        return listings142
Files main
Menu

Theme