From e67408a3901b23cf54c7f70ecf9de8cd3a792be0 Mon Sep 17 00:00:00 2001 From: Steffen Zimmermann Date: Sat, 18 Jun 2022 16:33:50 +0200 Subject: [PATCH] Revert "[feat] Add Wakefield Council" --- README.md | 1 - .../source/wakefield_gov_uk.py | 82 ------------------- doc/source/wakefield_gov_uk.md | 31 ------- info.md | 1 - 4 files changed, 115 deletions(-) delete mode 100644 custom_components/waste_collection_schedule/waste_collection_schedule/source/wakefield_gov_uk.py delete mode 100644 doc/source/wakefield_gov_uk.md diff --git a/README.md b/README.md index cd3b6723e..0d793bf7c 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,6 @@ Currently the following service providers are supported: - [Peterborough City Council - peterborough.gov.uk](./doc/source/peterborough_gov_uk.md) - [South Cambridgeshire District Council - scambs.gov.uk](./doc/source/scambs_gov_uk.md) - [City of York Council - york.gov.uk](./doc/source/york_gov_uk.md) -- [Wakefield Council - wakefield.gov.uk](./doc/source/wakefield_gov_uk.md) ## Installation diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/wakefield_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/wakefield_gov_uk.py deleted file mode 100644 index da7beae12..000000000 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/wakefield_gov_uk.py +++ /dev/null @@ -1,82 +0,0 @@ -import logging - -from datetime import datetime -from bs4 import BeautifulSoup - -import requests -from waste_collection_schedule import Collection - -TITLE = "wakefield.gov.uk" -DESCRIPTION = ( - "Source for wakefield.gov.uk services for Wakefield" -) -URL = "wakefield.gov.uk" -TEST_CASES = { - "houseUPRN" : {"uprn": "63161064"}, -} - -API_URLS = { - "collection": "https://www.wakefield.gov.uk/site/Where-I-Live-Results?uprn={}", -} - -ICONS = { - "Household waste": "mdi:trash-can", - "Mixed recycling": "mdi:recycle", - "Garden waste recycling": "mdi:leaf", -} - -_LOGGER = logging.getLogger(__name__) - - -class Source: - def __init__(self, uprn=None, postcode=None): - self._uprn = uprn - - def fetch(self): - user_agent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64)" - headers = {"User-Agent": user_agent} - - responseContent=None - r = requests.get(f"https://www.wakefield.gov.uk/site/Where-I-Live-Results?uprn={self._uprn}", headers) - responseContent = r.text - - soup = BeautifulSoup(responseContent, features="html.parser") - entries = [] - - #Full Credit to Rob Bradley for this: https://github.com/robbrad/UKBinCollectionData/blob/master/outputs/WakefieldCityCouncil.json - - for bins in soup.findAll( - "div", {"class": lambda L: L and L.startswith("mb10 ind-waste-")} - ): - - # Get the type of bin - bin_types = bins.find_all("div", {"class": "mb10"}) - bin_type = bin_types[0].get_text(strip=True) - - # Find the collection dates - binCollections = bins.find_all( - "div", {"class": lambda L: L and L.startswith("col-sm-4")} - ) - - if binCollections: - lastCollections = binCollections[0].find_all("div") - nextCollections = binCollections[1].find_all("div") - - # Get the collection date - lastCollection = lastCollections[1].get_text(strip=True) - nextCollection = nextCollections[1].get_text(strip=True) - - if lastCollection: - entries.append( - Collection( - date=datetime.strptime( - nextCollection, "%d/%m/%Y" - ).date(), - t=bin_type, - icon=ICONS.get(bin_type) - ) - ) - - return entries - - diff --git a/doc/source/wakefield_gov_uk.md b/doc/source/wakefield_gov_uk.md deleted file mode 100644 index 08c141299..000000000 --- a/doc/source/wakefield_gov_uk.md +++ /dev/null @@ -1,31 +0,0 @@ -# Wakefield Council - -Support for schedules provided by [Wakefield Council](https://www.wakefield.gov.uk/site/Where-I-Live-Results), serving the borough of Wakefield, UK. - -## Configuration via configuration.yaml - -```yaml -waste_collection_schedule: - sources: - - name: wakefield_gov_uk - args: - uprn: UPRN -``` - - -### Configuration Variables - -**uprn**
-*(string) (required)* - - - -## Examples - -```yaml -waste_collection_schedule: - sources: - - name: wakefield_gov_uk - args: - uprn: 63161064 -``` diff --git a/info.md b/info.md index e5a412df1..e2f2f3460 100644 --- a/info.md +++ b/info.md @@ -138,4 +138,3 @@ Currently the following service providers are supported: - [Peterborough City Council - peterborough.gov.uk](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/peterborough_gov_uk.md) - [South Cambridgeshire District Council - scambs.gov.uk](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/scambs_gov_uk.md) - [City of York Council - york.gov.uk](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/york_gov_uk.md) -- [Wakefield Council - wakefield.gov.uk](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/wakefield_gov_uk.md)