refactor main.py click to use click commands to allow passing parameters to commands and enable fetching districts by district name

This commit is contained in:
Viktor Barzin 2025-05-14 19:41:13 +00:00
parent bb2488a63b
commit ea56555884
3 changed files with 73 additions and 38 deletions

View file

@ -3,8 +3,13 @@ from rec.districts import get_districts
from data_access import Listing
def dump_listings():
districts = get_districts()
def dump_listings(district_names: set[str] | None = None):
districts = get_districts() if district_names is None else {
district: locid
for district, locid in get_districts().items()
if district in district_names
}
print("Valid districts to scrape:", districts.keys())
for district, locid in districts.items():
print("#### District:", district)
for i in [1, 2]: