spb/immo-ka Public
Immo-Ka — agrégateur des propriétés à vendre au Québec (73 connecteurs, ~40 000 annonces, React+FastAPI)
Python 64%
TypeScript 21.1%
CSS 14.3%
HTML 0.6%
1#!/usr/bin/env python32# -----------------------------------------------------------------------------3# Immo-Ka — Agrégateur de maisons à vendre (province de Québec)4# Auteur : Simon-Pierre Boucher — contact@spboucher.ai5# run.py : point d'entrée — `sync`, `watch`, `serve`6# -----------------------------------------------------------------------------7"""Utilisation :8 python run.py sync [source ...] # synchronise les propriétés9 python run.py watch [minutes] # synchronise en boucle (défaut 60 min)10 python run.py serve [port] # démarre l'API + le frontend (défaut 8090)11 python run.py list # liste les connecteurs enregistrés12"""13from __future__ import annotations1415import os16import sys17from pathlib import Path1819# Charger .env (FIRECRAWL_API_KEY, etc.) sans dépendance externe20_env = Path(__file__).parent / ".env"21if _env.exists():22 for line in _env.read_text().splitlines():23 line = line.strip()24 if line and not line.startswith("#") and "=" in line:25 k, _, v = line.partition("=")26 os.environ.setdefault(k.strip(), v.strip())272829def main() -> None:30 cmd = sys.argv[1] if len(sys.argv) > 1 else "serve"31 if cmd == "sync":32 from immoka import ingest33 ingest.run(sys.argv[2:] or None)34 elif cmd == "watch":35 from immoka import ingest36 minutes = int(sys.argv[2]) if len(sys.argv) > 2 else 6037 ingest.watch(minutes * 60)38 elif cmd == "list":39 from immoka.connectors import CONNECTORS40 for sid in sorted(CONNECTORS):41 print(sid)42 print(f"-- {len(CONNECTORS)} connecteur(s)")43 elif cmd == "serve":44 import uvicorn45 port = int(sys.argv[2]) if len(sys.argv) > 2 else 809046 uvicorn.run("immoka.web:app", host="0.0.0.0", port=port)47 else:48 print(__doc__)49 sys.exit(1)505152if __name__ == "__main__":53 main()54