Lou·Ka — tous les logements à louer du Québec, un seul endroit.
HTML 98.9%
Python 0.6%
1# -----------------------------------------------------------------------------2# Lou-Ka — Agrégateur de logements à louer (province de Québec)3# Auteur : Simon-Pierre Boucher — contact@spboucher.ai4# connectors/lac_jerome.py : connecteur Habitations du Lac Jérôme5# (habitationsdulacjerome.com — 3 projets locatifs neufs à Saint-Jérôme :6# Le Seize (condos), La Quaza (maisons et bachelors), Le Hexa (condos)).7# Le site WordPress affiche ses unités via le widget Planpoint : on8# interroge l'API JSON publique (app.planpoint.io/api/groups/find,9# 1 requête/sync, voir _planpoint.py). Granularité UNITÉ, AVEC prix10# mensuel publié (1 900 $ à 2 800 $), pi², plans par unité, inclusions11# françaises et date de livraison. Les projets Planpoint n'ont ni adresse12# ni lat/lng ; chez La Quaza et Le Hexa le NOM de l'unité est une adresse13# civique (« 113 Réal-Piché ») qu'on récupère comme adresse. Seules les14# unités « Available » sont retenues.15# -----------------------------------------------------------------------------16from __future__ import annotations1718import re1920from ..schema import Listing21from ._planpoint import planpoint_projects, unit_listing22from .base import BaseConnector2324PAGE_URL = "https://habitationsdulacjerome.com/"25NAMESPACE = "habitations-du-lac-jerome"26HOST_NAME = "for-rent"2728# « 113 Réal-Piché » -> adresse civique (rue du projet à Saint-Jérôme)29_CIVIC_RE = re.compile(r"^\d+\s+[A-ZÀ-Ü]", re.U)303132class LacJeromeConnector(BaseConnector):33 source_id = "lac_jerome"34 request_delay = 0.83536 def fetch(self) -> list[Listing]:37 try:38 projects = planpoint_projects(self, "groups", NAMESPACE, HOST_NAME)39 except Exception:40 return []41 listings: list[Listing] = []42 for project in projects:43 for floor in project.get("floors") or []:44 for unit in floor.get("units") or []:45 lst = unit_listing(self.source_id, project, floor, unit,46 page_url=PAGE_URL,47 default_city="Saint-Jérôme")48 if lst is None:49 continue50 # adresse civique dans le nom d'unité (La Quaza, Le Hexa)51 name = (unit.get("name") or "").strip()52 if not lst.address and _CIVIC_RE.match(name):53 lst.address = name54 listings.append(lst)55 return listings56