Skip to content

Commit

Permalink
nsomester_gov_uk shows next two instead of only the next event
Browse files Browse the repository at this point in the history
  • Loading branch information
5ila5 committed Nov 17, 2023
1 parent 51687ac commit 319d0c8
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import requests
from bs4 import BeautifulSoup
from waste_collection_schedule import Collection
from waste_collection_schedule import Collection # type: ignore[attr-defined]

TITLE = "North Somerset Council"
DESCRIPTION = "Source for n-somerset.gov.uk services for North Somerset, UK."
Expand Down Expand Up @@ -65,17 +65,19 @@ def fetch(self):

for collection in table_data:
try:
entries.append(
Collection(
date=datetime.strptime(
collection["Next collection date"], "%A %d %B"
for date in [
collection["Next collection date"],
collection.get("Following collection date"),
]:
entries.append(
Collection(
date=datetime.strptime(date, "%A %d %B")
.replace(year=datetime.now().year)
.date(),
t=collection["Service"],
icon=ICON_MAP.get(collection["Service"].upper()),
)
.replace(year=datetime.now().year)
.date(),
t=collection["Service"],
icon=ICON_MAP.get(collection["Service"].upper()),
)
)
except ValueError:
pass

Expand Down

0 comments on commit 319d0c8

Please sign in to comment.