Move UPRN and postcode values to config

Closes: #136
This commit is contained in:
Edward Betts 2024-03-05 10:07:21 +01:00
parent 7d5cfe859a
commit 4ade643de6
2 changed files with 19 additions and 12 deletions

View file

@ -105,11 +105,10 @@ def dates_from_rrule(
] ]
async def waste_collection_events(data_dir: str) -> list[Event]: async def waste_collection_events(
data_dir: str, postcode: str, uprn: str
) -> list[Event]:
"""Waste colllection events.""" """Waste colllection events."""
postcode = "BS48 3HG"
uprn = "24071046"
html = await waste_schedule.get_html(data_dir, postcode, uprn) html = await waste_schedule.get_html(data_dir, postcode, uprn)
root = lxml.html.fromstring(html) root = lxml.html.fromstring(html)
events = waste_schedule.parse(root) events = waste_schedule.parse(root)
@ -117,11 +116,9 @@ async def waste_collection_events(data_dir: str) -> list[Event]:
async def bristol_waste_collection_events( async def bristol_waste_collection_events(
data_dir: str, start_date: date data_dir: str, start_date: date, uprn: str
) -> list[Event]: ) -> list[Event]:
"""Waste colllection events.""" """Waste colllection events."""
uprn = "358335"
return await waste_schedule.get_bristol_gov_uk(start_date, data_dir, uprn) return await waste_schedule.get_bristol_gov_uk(start_date, data_dir, uprn)
@ -375,8 +372,20 @@ async def get_data(
t0 = time() t0 = time()
result_list = await asyncio.gather( result_list = await asyncio.gather(
time_function("gwr_advance_tickets", gwr.advance_ticket_date, data_dir), time_function("gwr_advance_tickets", gwr.advance_ticket_date, data_dir),
time_function("backwell_bins", waste_collection_events, data_dir), time_function(
time_function("bristol_bins", bristol_waste_collection_events, data_dir, today), "backwell_bins",
waste_collection_events,
data_dir,
config["BACKWELL_POSTCODE"],
config["BACKWELL_UPRN"],
),
time_function(
"bristol_bins",
bristol_waste_collection_events,
data_dir,
today,
config["BRISTOL_UPRN"],
),
) )
rockets = thespacedevs.read_cached_launches(rocket_dir) rockets = thespacedevs.read_cached_launches(rocket_dir)

View file

@ -14,10 +14,8 @@ config = __import__("config.default", fromlist=[""])
async def bristol_waste_collection_events() -> list[agenda.types.Event]: async def bristol_waste_collection_events() -> list[agenda.types.Event]:
"""Waste colllection events.""" """Waste colllection events."""
uprn = "358335"
return await agenda.waste_schedule.get_bristol_gov_uk( return await agenda.waste_schedule.get_bristol_gov_uk(
date.today(), config.DATA_DIR, uprn, refresh=True date.today(), config.DATA_DIR, config.BRISTOL_UPRN, refresh=True
) )