Skip to content

Commit

Permalink
fix: #1073 - change method of generating bin types to avoid manual ma…
Browse files Browse the repository at this point in the history
…pping for Rugby Borough Council
  • Loading branch information
dp247 committed Dec 19, 2024
1 parent 53de600 commit b1d8358
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ class CouncilClass(AbstractGetBinDataClass):

def parse_data(self, page: str, **kwargs) -> dict:
data = {"bins": []}
bin_types = {
"240L RUBBISH BIN": "Black bin",
"240L GARDEN BIN": "Green bin",
"180L RECYCLING BIN": "Blue lid bin",
}
collections = []

user_postcode = kwargs.get("postcode")
Expand Down Expand Up @@ -73,7 +68,8 @@ def parse_data(self, page: str, **kwargs) -> dict:

for row in table_rows:
row_text = row.text.strip().split("\n")
bin_type = bin_types.get(row_text[0])
bin_text = row_text[0].split(" ")
bin_type = ' '.join(bin_text[1:]).capitalize()
collections.append(
(bin_type, datetime.strptime(row_text[1], "%A %d %b %Y"))
)
Expand Down

0 comments on commit b1d8358

Please sign in to comment.