add command to export the data in a way that the ui (immoweb) can consume

This commit is contained in:
Viktor Barzin 2025-05-26 19:36:54 +00:00
parent 102c20ac42
commit 7e8c79d3d1
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
4 changed files with 66 additions and 3 deletions

View file

@ -10,6 +10,7 @@ from data_access import Listing
import csv_exporter
from rec.query import ListingType, FurnishType
from rec.routing import API_KEY_ENVIRONMENT_VARIABLE, TravelMode
from ui_exporter import export_immoweb as export_immoweb_ui
dump_listings_module = importlib.import_module('1_dump_listings')
dump_detail_module = importlib.import_module('2_dump_detail')
@ -230,6 +231,25 @@ def export_csv(ctx: click.core.Context, output_file: str, columns: tuple[str]):
asyncio.run(
csv_exporter.export_to_csv(listings, output_file_path,
list(columns)), )
@cli.command()
@click.option(
'--output-file',
'-O',
help='Path to the output immoweb file',
required=True,
type=click.Path(
writable=True,
file_okay=True,
dir_okay=False,
resolve_path=True,
),
)
@click.pass_context
def export_immoweb(ctx, output_file: str):
click.echo(f'Exporting data to {output_file}')
asyncio.run(export_immoweb_ui(ctx, output_file))
if __name__ == '__main__':