parameterize data path when fetching listings
This commit is contained in:
parent
ea56555884
commit
48d379567b
3 changed files with 28 additions and 11 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import pathlib
|
||||
import click
|
||||
import importlib
|
||||
|
||||
|
|
@ -31,9 +32,23 @@ def cli():
|
|||
type=click.Choice(get_districts().keys(), case_sensitive=False),
|
||||
multiple=True,
|
||||
)
|
||||
def dump_listings(district: list[str]):
|
||||
click.echo(f'Running dump_listings for districts {district}')
|
||||
dump_listings_module.dump_listings(set(district))
|
||||
@click.option(
|
||||
'--data-dir',
|
||||
default=pathlib.Path("data/rs/"),
|
||||
help='Districts to scrape',
|
||||
type=click.Path(
|
||||
writable=True,
|
||||
file_okay=False,
|
||||
dir_okay=True,
|
||||
resolve_path=True,
|
||||
),
|
||||
)
|
||||
def dump_listings(district: list[str], data_dir: str):
|
||||
click.echo(
|
||||
f'Running dump_listings for districts {district} and data dir {data_dir}'
|
||||
)
|
||||
data_dir_path = pathlib.Path(data_dir)
|
||||
dump_listings_module.dump_listings(set(district), data_dir_path)
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue