feat: AR-House initial commit
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
"""scrapers/miami_dade_clerk.py — Backward-compat shim.
|
||||
|
||||
ESTA MODULO ES UN ALIAS DE realauction_clerk.py para Miami-Dade.
|
||||
|
||||
La logica generica fue extraida a `realauction_clerk.py` cuando se agregaron
|
||||
soporte para Duval, Broward, Palm Beach, Hillsborough, Orange (todos comparten
|
||||
el mismo white-label platform de realauction.com).
|
||||
|
||||
Mantener este shim mientras:
|
||||
- Tests legacy importen de `scrapers.miami_dade_clerk`
|
||||
- Migration scripts referencien `_parse_cases_from_html`, `_is_status_dead`
|
||||
- El source_id 'miami_dade_clerk' siga en deals.db
|
||||
|
||||
API publica preservada:
|
||||
SOURCE — string 'miami_dade_clerk'
|
||||
scrape_miami_dade_auctions(...) — scrape function
|
||||
run_scraper_to_db(...) — pipeline
|
||||
_parse_cases_from_html(...) — exposed for tests
|
||||
_is_status_dead(...) — exposed for tests
|
||||
_DEAD_STATUS_SUBSTRINGS — exposed for tests
|
||||
_build_deal_record(case, date) — exposed for tests
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, Optional
|
||||
|
||||
from scrapers.realauction_clerk import (
|
||||
REALAUCTION_COUNTIES,
|
||||
get_county_config,
|
||||
scrape_realauction_county,
|
||||
run_scraper_to_db as _generic_run_scraper_to_db,
|
||||
# Re-exports for backward compat
|
||||
_parse_cases_from_html, # noqa: F401
|
||||
_is_status_dead, # noqa: F401
|
||||
_DEAD_STATUS_SUBSTRINGS, # noqa: F401
|
||||
_extract_case_from_table_rows, # noqa: F401
|
||||
_parse_address, # noqa: F401
|
||||
_parse_money, # noqa: F401
|
||||
_build_description, # noqa: F401
|
||||
)
|
||||
|
||||
SOURCE = "miami_dade_clerk"
|
||||
_COUNTY = "Miami-Dade"
|
||||
|
||||
|
||||
def scrape_miami_dade_auctions(
|
||||
*,
|
||||
days_ahead: int = 14,
|
||||
days_back: int = 0,
|
||||
status_cb: Optional[Callable[[str], None]] = None,
|
||||
max_dates: Optional[int] = None,
|
||||
use_cache: bool = True,
|
||||
cache_ttl_seconds: int = 86400,
|
||||
) -> list[dict]:
|
||||
"""Scrape Miami-Dade County auction calendar (delegates to realauction_clerk)."""
|
||||
return scrape_realauction_county(
|
||||
county=_COUNTY,
|
||||
days_ahead=days_ahead,
|
||||
days_back=days_back,
|
||||
status_cb=status_cb,
|
||||
max_dates=max_dates,
|
||||
use_cache=use_cache,
|
||||
cache_ttl_seconds=cache_ttl_seconds,
|
||||
)
|
||||
|
||||
|
||||
def run_scraper_to_db(
|
||||
*,
|
||||
days_ahead: int = 14,
|
||||
days_back: int = 0,
|
||||
auto_classify: bool = True,
|
||||
status_cb: Optional[Callable[[str], None]] = None,
|
||||
max_dates: Optional[int] = None,
|
||||
) -> dict:
|
||||
"""Full pipeline for Miami-Dade (delegates to realauction_clerk)."""
|
||||
return _generic_run_scraper_to_db(
|
||||
county=_COUNTY,
|
||||
days_ahead=days_ahead,
|
||||
days_back=days_back,
|
||||
auto_classify=auto_classify,
|
||||
status_cb=status_cb,
|
||||
max_dates=max_dates,
|
||||
)
|
||||
|
||||
|
||||
def _build_deal_record(case: dict, auction_date_iso: str) -> dict:
|
||||
"""Backward-compat: original signature was (case, date) without county_config.
|
||||
|
||||
Tests use this. Internally delegates to the generic builder with Miami-Dade config.
|
||||
"""
|
||||
from scrapers.realauction_clerk import _build_deal_record as _generic_build
|
||||
return _generic_build(case, auction_date_iso, REALAUCTION_COUNTIES[_COUNTY])
|
||||
Reference in New Issue
Block a user