Repository Public
1# =============================================================================2# SP BOUCHER | SOFTWARE & RESEARCH3# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project : Lou·Ka9# File : louka/connectors/boises_cite.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/boises_cite.py : connecteur Les Boisés de la Cité91# (lesboisesdelacite.com) — 43 logements locatifs neufs (3½ à 4½ + bureau)92# au 15, rue des Sentiers à Sainte-Marie (Beauce). La page /plans-prix/93# embarque le widget Planpoint : on interroge l'API JSON publique94# (app.planpoint.io/api/projects/find, 1 requête/sync — voir _planpoint.py).95# Granularité UNITÉ : prix mensuel publié, pi², chambres, sdb, plans,96# inclusions ; seules les unités « Available » sont retenues.97# -----------------------------------------------------------------------------98from __future__ import annotations99100from ..schema import Listing101from ._planpoint import planpoint_projects, unit_listing102from .base import BaseConnector103104PAGE_URL = "https://lesboisesdelacite.com/plans-prix/"105NAMESPACE = "Lesboisesdelacit"106HOST_NAME = "demo"107108# le projet Planpoint ne publie ni adresse ni coordonnées : on les fixe ici109ADDRESS = "15, rue des Sentiers, Sainte-Marie"110CONTACT = {"email": "info@lesboisesdelacite.com", "phone": "418-389-7584"}111112113class BoisesCiteConnector(BaseConnector):114 source_id = "boises_cite"115 request_delay = 0.8116117 def fetch(self) -> list[Listing]:118 try:119 projects = planpoint_projects(self, "projects",120 NAMESPACE, HOST_NAME)121 except Exception:122 return []123 listings: list[Listing] = []124 for project in projects:125 for floor in project.get("floors") or []:126 for unit in floor.get("units") or []:127 lst = unit_listing(self.source_id, project, floor, unit,128 page_url=PAGE_URL,129 default_city="Sainte-Marie")130 if lst is None:131 continue132 lst.address = ADDRESS # absent du JSON Planpoint133 lst.details["contact"] = dict(CONTACT)134 # `bedrooms` Planpoint est un entier nu (« 2 ») que le135 # helper ne convertit pas : n chambres -> (n+2)½136 try:137 beds = float(unit.get("bedrooms") or 0)138 except (TypeError, ValueError):139 beds = 0.0140 if beds > 0 and "½" not in lst.unit_type:141 lst.bedrooms = float(beds)142 n = int(beds) + 2143 lst.unit_type = "6½+" if n >= 6 else f"{n}½"144 listings.append(lst)145 return listings146