HTML 82%
Python 14.7%
TypeScript 1.9%
CSS 1%
JavaScript 0.5%
1#!/usr/bin/env python32# =============================================================================3# Job·Ka — Groupe KA4# Auteur : Simon-Pierre Boucher5# Contact : contact@spboucher.ai6# Fichier : run.py7# Rôle : Point d'entrée — sync, watch, serve, geocode, record8# Créé : 2026-08-17 Modifié : 2026-08-179# =============================================================================10"""Utilisation :11 python run.py sync [source ...] # synchronise les offres12 python run.py watch [minutes] # synchronise en boucle (défaut 60 min)13 python run.py serve [port] # démarre l'API + le frontend (défaut 8096)14 python run.py geocode [n] # géocode les offres sans coordonnées15 python run.py record <source ...> # enregistre les fixtures de test d'une source16"""17from __future__ import annotations1819import os20import sys21from pathlib import Path2223# Charger .env (SCRAPFLY_API_KEY, etc.) sans dépendance externe24_env = Path(__file__).parent / ".env"25if _env.exists():26 for line in _env.read_text().splitlines():27 line = line.strip()28 if line and not line.startswith("#") and "=" in line:29 k, _, v = line.partition("=")30 os.environ.setdefault(k.strip(), v.strip())313233def main() -> None:34 cmd = sys.argv[1] if len(sys.argv) > 1 else "serve"35 if cmd == "sync":36 from jobka import ingest37 ingest.run(sys.argv[2:] or None)38 elif cmd == "watch":39 from jobka import ingest40 minutes = int(sys.argv[2]) if len(sys.argv) > 2 else 6041 ingest.watch(minutes * 60)42 elif cmd == "geocode":43 from jobka import geocode44 limit = int(sys.argv[2]) if len(sys.argv) > 2 else None45 geocode.run_batch(limit)46 elif cmd == "record":47 from jobka import fixtures48 from jobka.connectors import CONNECTORS49 targets = sys.argv[2:] or sorted(CONNECTORS)50 for sid in targets:51 try:52 print(f"[job-ka] record {sid} ... {fixtures.record(sid)}")53 except Exception as exc:54 print(f"[job-ka] record {sid} ÉCHEC : {exc}", file=sys.stderr)55 elif cmd == "serve":56 import uvicorn57 port = int(sys.argv[2]) if len(sys.argv) > 2 else 809658 uvicorn.run("jobka.web:app", host="0.0.0.0", port=port)59 else:60 print(__doc__)61 sys.exit(1)626364if __name__ == "__main__":65 main()66