parameterize data path when fetching listings

This commit is contained in:
Viktor Barzin 2025-05-14 20:19:08 +00:00
parent ea56555884
commit 48d379567b
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
3 changed files with 28 additions and 11 deletions

View file

@ -1,9 +1,13 @@
import pathlib
from rec.query import listing_query
from rec.districts import get_districts
from data_access import Listing
def dump_listings(district_names: set[str] | None = None):
def dump_listings(
district_names: set[str] | None = None,
data_dir: pathlib.Path = pathlib.Path("data/rs/")
):
districts = get_districts() if district_names is None else {
district: locid
for district, locid in get_districts().items()
@ -37,7 +41,7 @@ def dump_listings(district_names: set[str] | None = None):
for property in d["properties"]:
identifier = property["identifier"]
listing = Listing(identifier)
listing = Listing(identifier, data_dir=data_dir)
listing.dump_listing(property)
print() # break line as we used end=, above.