Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Manchester City Council #758

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
URL = "https://www.manchester.gov.uk"
TEST_CASES = {
"domestic": {"uprn": "000077065560"},
"large_domestic": {"uprn": 77116538},
}

API_URL = "https://www.manchester.gov.uk/bincollections/"
Expand All @@ -18,14 +19,17 @@
"Blue Bin": "mdi:recycle",
"Brown Bin": "mdi:glass-fragile",
"Green Bin": "mdi:leaf",
"Large Blue Container": "mdi:recycle",
"Large Brown Container": "mdi:glass-fragile",
"Large Domestic Waste Container": "mdi:trash-can",
}

_LOGGER = logging.getLogger(__name__)


class Source:
def __init__(self, uprn: int):
self._uprn = uprn
self._uprn = str(uprn).zfill(12)

def fetch(self):
entries = []
Expand All @@ -44,8 +48,8 @@ def fetch(self):
dates.append(str(date.text).replace("Next collection ", "", 1))
for date in result.find_all("li"):
dates.append(date.text)
img_tag = result.find("img")
collection_type = img_tag["alt"]
h3_tag = result.find("h3")
collection_type = h3_tag.text.replace("DUE TODAY", "").strip()
for current_date in dates:
date = datetime.strptime(current_date, "%A %d %b %Y").date()
entries.append(
Expand Down