uk_bin_collection 0.98.3__py3-none-any.whl → 0.98.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -132,7 +132,7 @@
132
132
  "BradfordMDC": {
133
133
  "custom_component_show_url_field": false,
134
134
  "skip_get_url": true,
135
- "uprn": "100052235823",
135
+ "uprn": "100051146921",
136
136
  "url": "https://onlineforms.bradford.gov.uk/ufs/collectiondates.eb",
137
137
  "wiki_name": "Bradford MDC",
138
138
  "wiki_note": "To get the UPRN, you will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search). Post code isn't parsed by this script, but you can pass it in double quotes."
@@ -680,7 +680,7 @@
680
680
  },
681
681
  "ManchesterCityCouncil": {
682
682
  "skip_get_url": true,
683
- "uprn": "000077048077",
683
+ "uprn": "77127089",
684
684
  "url": "https://www.manchester.gov.uk/bincollections",
685
685
  "wiki_name": "Manchester City Council"
686
686
  },
@@ -691,7 +691,7 @@
691
691
  "wiki_name": "Mansfield District Council"
692
692
  },
693
693
  "MertonCouncil": {
694
- "url": "https://myneighbourhood.merton.gov.uk/Wasteservices/WasteServices.aspx?ID=28298025",
694
+ "url": "https://myneighbourhood.merton.gov.uk/wasteservices/WasteServices.aspx?ID=25851371",
695
695
  "wiki_command_url_override": "https://myneighbourhood.merton.gov.uk/Wasteservices/WasteServices.aspx?ID=XXXXXXXX",
696
696
  "wiki_name": "Merton Council",
697
697
  "wiki_note": "Follow the instructions [here](https://myneighbourhood.merton.gov.uk/Wasteservices/WasteServicesSearch.aspx) until you get the \"Your recycling and rubbish collection days\" page then copy the URL and replace the URL in the command (the Address parameter is optional)."
@@ -1128,7 +1128,8 @@
1128
1128
  "SwaleBoroughCouncil": {
1129
1129
  "postcode": "ME12 2NQ",
1130
1130
  "skip_get_url": true,
1131
- "uprn": "100061081168",
1131
+ "house_number": "81",
1132
+ "web_driver": "http://selenium:4444",
1132
1133
  "url": "https://swale.gov.uk/bins-littering-and-the-environment/bins/collection-days",
1133
1134
  "wiki_name": "Swale Borough Council"
1134
1135
  },
@@ -74,13 +74,30 @@ class CouncilClass(AbstractGetBinDataClass):
74
74
 
75
75
  driver.get(page)
76
76
 
77
+ wait = WebDriverWait(driver, 10)
78
+ accept_cookies_button = wait.until(
79
+ EC.element_to_be_clickable(
80
+ (
81
+ By.XPATH,
82
+ "//button[contains(text(), 'Accept additional cookies')]",
83
+ )
84
+ )
85
+ )
86
+ accept_cookies_button.click()
87
+
77
88
  # Wait for the element to be clickable
78
- find_your_collection_button = WebDriverWait(driver, 10).until(
89
+ wait = WebDriverWait(driver, 10)
90
+ find_your_collection_button = wait.until(
79
91
  EC.element_to_be_clickable(
80
- (By.XPATH, '//a[contains(text(), "Find your household collection day")]')
92
+ (By.LINK_TEXT, "Find your household collection day")
81
93
  )
82
94
  )
83
95
 
96
+ # Scroll to the element (in case something is blocking it)
97
+ driver.execute_script(
98
+ "arguments[0].scrollIntoView();", find_your_collection_button
99
+ )
100
+
84
101
  # Click the element
85
102
  find_your_collection_button.click()
86
103
 
@@ -107,12 +124,12 @@ class CouncilClass(AbstractGetBinDataClass):
107
124
 
108
125
  postcode_input.send_keys(user_postcode)
109
126
 
110
- find_address_button = WebDriverWait(driver, 10).until(
111
- EC.presence_of_element_located(
112
- (By.CSS_SELECTOR, '[value="Find address"]')
113
- )
127
+ find_address_button = WebDriverWait(driver, 30).until(
128
+ EC.element_to_be_clickable((By.CSS_SELECTOR, '[value="Find address"]'))
114
129
  )
115
- find_address_button.click()
130
+ driver.execute_script("arguments[0].scrollIntoView();", find_address_button)
131
+ driver.execute_script("arguments[0].click();", find_address_button)
132
+ # find_address_button.click()
116
133
 
117
134
  time.sleep(15)
118
135
  # Wait for address box to be visible
@@ -1,5 +1,6 @@
1
1
  import requests
2
2
  from bs4 import BeautifulSoup
3
+
3
4
  from uk_bin_collection.uk_bin_collection.common import *
4
5
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
5
6
 
@@ -92,7 +93,6 @@ class CouncilClass(AbstractGetBinDataClass):
92
93
  dict_data = {
93
94
  "type": bin_type,
94
95
  "collectionDate": bin_date,
95
- "colour": bin_colour,
96
96
  }
97
97
  data["bins"].append(dict_data)
98
98
 
@@ -1,4 +1,5 @@
1
1
  from bs4 import BeautifulSoup
2
+
2
3
  from uk_bin_collection.uk_bin_collection.common import *
3
4
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
4
5
 
@@ -18,36 +19,34 @@ class CouncilClass(AbstractGetBinDataClass):
18
19
  # Declare an empty dict for data, and pair icon source URLs with their respective bin type
19
20
  data = {"bins": []}
20
21
  bin_types = {
21
- "../images/bins/cal_blue.png": "Mixed recycling",
22
- "../images/bins/cal_green.png": "General waste",
23
- "../images/bins/cal_grey.png": "Food waste",
24
- "../images/bins/cal_brown.png": "Organic waste",
25
- "../images/bins/cal_purple.png": "Glass",
26
- "../images/bins/cal_ash.png": "Ash bin",
22
+ "../Images/Bins/blueBin.gif": "Mixed recycling",
23
+ "../Images/Bins/greenBin.gif": "General waste",
24
+ "../Images/Bins/greyBin.gif": "Food waste",
25
+ "../Images/Bins/brownBin.gif": "Organic waste",
26
+ "../Images/Bins/purpleBin.gif": "Glass",
27
+ "../Images/Bins/ashBin.gif": "Ash bin",
27
28
  }
28
29
 
29
30
  # Find the page body with all the calendars
30
- body = soup.find("div", {"id": "printArticle"})
31
- cal_year = datetime.strptime(soup.select("#Year")[0].text.strip(), "%Y").year
31
+ body = soup.find("div", {"id": "Application_ctl00"})
32
32
  calendars = body.find_all_next("table", {"title": "Calendar"})
33
-
34
33
  # For each calendar grid, get the month and all icons within it. We only take icons with alt text, as this
35
34
  # includes the bin type while excluding spacers
36
35
  for item in calendars:
37
- cal_month = datetime.strptime(item.find_next("td").text.strip(), "%B").month
38
- icons = item.find_all("img", alt=True)
39
-
36
+ icons = item.find_all("img")
40
37
  # For each icon, get the day box, so we can parse the correct day number and make a datetime
41
38
  for icon in icons:
42
- cal_item = icon.find_parent().find_parent().find_parent().contents
43
- cal_day = datetime.strptime(cal_item[1].text.strip(), "%d").day
44
- bin_date = datetime(cal_year, cal_month, cal_day)
39
+ cal_item = icon.find_parent().find_parent()
40
+ bin_date = datetime.strptime(
41
+ cal_item["title"],
42
+ "%A, %d %B %Y",
43
+ )
45
44
 
46
45
  # If the collection date is in the future, we want the date. Select the correct type, add the new
47
46
  # datetime, then add to the list
48
47
  if datetime.now() <= bin_date:
49
48
  dict_data = {
50
- "type": bin_types.get(icon["src"].lower()),
49
+ "type": bin_types.get(icon["src"]),
51
50
  "collectionDate": bin_date.strftime(date_format),
52
51
  }
53
52
  data["bins"].append(dict_data)
@@ -80,6 +80,10 @@ class CouncilClass(AbstractGetBinDataClass):
80
80
  )
81
81
  )
82
82
  search_btn.send_keys(Keys.ENTER)
83
+ WebDriverWait(driver, 10).until(
84
+ EC.presence_of_element_located((By.ID, "collectionTabs"))
85
+ )
86
+
83
87
  soup = BeautifulSoup(driver.page_source, features="html.parser")
84
88
 
85
89
  # Find all tab panels within the collectionTabs
@@ -18,90 +18,73 @@ class CouncilClass(AbstractGetBinDataClass):
18
18
  # Get and check UPRN
19
19
  user_uprn = kwargs.get("uprn")
20
20
  check_uprn(user_uprn)
21
+ bindata = {"bins": []}
21
22
 
22
- # Start a new session to walk through the form
23
- requests.packages.urllib3.disable_warnings()
24
- s = requests.Session()
25
-
26
- # There's a cookie that makes the whole thing valid when you search for a postcode,
27
- # but postcode and UPRN is a hassle imo, so this makes a request for the session to get a cookie
28
- # using a Manchester City Council postcode I hardcoded in the data payload
29
- postcode_request_header = {
30
- "authority": "www.manchester.gov.uk",
31
- "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,"
32
- "image/webp,image/apng,*/*;q=0.8",
33
- "accept-language": "en-GB,en;q=0.6",
34
- "cache-control": "max-age=0",
35
- # Requests sorts cookies= alphabetically
36
- "origin": "https://www.manchester.gov.uk",
37
- "referer": "https://www.manchester.gov.uk/bincollections",
38
- "sec-fetch-dest": "document",
39
- "sec-fetch-mode": "navigate",
40
- "sec-fetch-site": "same-origin",
41
- "sec-fetch-user": "?1",
42
- "sec-gpc": "1",
43
- "upgrade-insecure-requests": "1",
44
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, "
45
- "like Gecko) Chrome/104.0.5112.102 Safari/537.36",
23
+ COLLECTION_MAP = {
24
+ "ahtm_dates_black_bin": "Black bin",
25
+ "ahtm_dates_brown_commingled_bin": "Brown bin",
26
+ "ahtm_dates_blue_pulpable_bin": "Blue bin",
27
+ "ahtm_dates_green_organic_bin": "Green Bin",
46
28
  }
47
- postcode_request_data = {
48
- "mcc_bin_dates_search_term": "M2 5DB",
49
- "mcc_bin_dates_submit": "Go",
50
- }
51
- response = s.post(
52
- "https://www.manchester.gov.uk/bincollections",
53
- headers=postcode_request_header,
54
- data=postcode_request_data,
55
- )
56
29
 
57
- # Make a POST with the same cookie-fied session using the user's UPRN data
58
- uprn_request_headers = {
59
- "authority": "www.manchester.gov.uk",
60
- "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
61
- "accept-language": "en-GB,en;q=0.6",
62
- "cache-control": "max-age=0",
63
- # Requests sorts cookies= alphabetically
64
- # 'cookie': 'TestCookie=Test; CookieConsent={stamp:%27D8rypjMDBJhpfMWybSMdGXP1hCZWGJYtGETiMTu1UuXTdRIKl8SU5g==%27%2Cnecessary:true%2Cpreferences:true%2Cstatistics:true%2Cmarketing:true%2Cver:6%2Cutc:1661783732090%2Cregion:%27gb%27}; PHPSESSID=kElJxYAt%2Cf-4ZWoskt0s5tn32BUQRXDYUVp3G-NsqOAOaeIcKlm2T4r7ATSgqfz6',
65
- "origin": "https://www.manchester.gov.uk",
66
- "referer": "https://www.manchester.gov.uk/bincollections",
67
- "sec-fetch-dest": "document",
68
- "sec-fetch-mode": "navigate",
69
- "sec-fetch-site": "same-origin",
70
- "sec-fetch-user": "?1",
71
- "sec-gpc": "1",
72
- "upgrade-insecure-requests": "1",
73
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36",
30
+ API_URL = "https://manchester.form.uk.empro.verintcloudservices.com/api/custom?action=bin_checker-get_bin_col_info&actionedby=_KDF_custom&loadform=true&access=citizen&locale=en"
31
+ AUTH_URL = "https://manchester.form.uk.empro.verintcloudservices.com/api/citizen?archived=Y&preview=false&locale=en"
32
+ AUTH_KEY = "Authorization"
33
+
34
+ r = requests.get(AUTH_URL)
35
+ r.raise_for_status()
36
+ auth_token = r.headers[AUTH_KEY]
37
+
38
+ post_data = {
39
+ "name": "sr_bin_coll_day_checker",
40
+ "data": {
41
+ "uprn": user_uprn,
42
+ "nextCollectionFromDate": (datetime.now() - timedelta(days=1)).strftime(
43
+ "%Y-%m-%d"
44
+ ),
45
+ "nextCollectionToDate": (datetime.now() + timedelta(days=30)).strftime(
46
+ "%Y-%m-%d"
47
+ ),
48
+ },
49
+ "email": "",
50
+ "caseid": "",
51
+ "xref": "",
52
+ "xref1": "",
53
+ "xref2": "",
74
54
  }
75
- uprn_request_data = {
76
- "mcc_bin_dates_uprn": user_uprn,
77
- "mcc_bin_dates_submit": "Go",
55
+
56
+ headers = {
57
+ "referer": "https://manchester.portal.uk.empro.verintcloudservices.com/",
58
+ "accept": "application/json",
59
+ "content-type": "application/json",
60
+ AUTH_KEY: auth_token,
78
61
  }
79
- response = s.post(
80
- "https://www.manchester.gov.uk/bincollections",
81
- headers=uprn_request_headers,
82
- data=uprn_request_data,
83
- )
84
62
 
85
- # Make that BS4 object and use it to prettify the response
86
- soup = BeautifulSoup(response.content, features="html.parser")
87
- soup.prettify()
88
-
89
- # Get the collection items on the page and strip the bits of text that we don't care for
90
- collections = []
91
- for bin in soup.find_all("div", {"class": "collection"}):
92
- bin_type = bin.find_next("h3").text.replace(" DUE TODAY", "").strip()
93
- next_collection = bin.find_next("p").text.replace("Next collection ", "")
94
- next_collection = datetime.strptime(next_collection, "%A %d %b %Y")
95
- collections.append((bin_type, next_collection))
96
-
97
- # Sort the collections by date order rather than bin type, then return as a dictionary (with str date)
98
- ordered_data = sorted(collections, key=lambda x: x[1])
99
- data = {"bins": []}
100
- for item in ordered_data:
101
- dict_data = {
102
- "type": item[0],
103
- "collectionDate": item[1].strftime(date_format),
104
- }
105
- data["bins"].append(dict_data)
106
-
107
- return data
63
+ r = requests.post(API_URL, data=json.dumps(post_data), headers=headers)
64
+ r.raise_for_status()
65
+
66
+ result = r.json()
67
+ print(result["data"])
68
+
69
+ for key, value in result["data"].items():
70
+ if key.startswith("ahtm_dates_"):
71
+ print(key)
72
+ print(value)
73
+
74
+ dates_list = [
75
+ datetime.strptime(date.strip(), "%d/%m/%Y %H:%M:%S").date()
76
+ for date in value.split(";")
77
+ if date.strip()
78
+ ]
79
+
80
+ for current_date in dates_list:
81
+ dict_data = {
82
+ "type": COLLECTION_MAP.get(key),
83
+ "collectionDate": current_date.strftime(date_format),
84
+ }
85
+ bindata["bins"].append(dict_data)
86
+
87
+ bindata["bins"].sort(
88
+ key=lambda x: datetime.strptime(x.get("collectionDate"), "%d/%m/%Y")
89
+ )
90
+ return bindata
@@ -106,6 +106,7 @@ class CouncilClass(AbstractGetBinDataClass):
106
106
  bin_date = datetime.strptime(
107
107
  date.get_text(strip=True)
108
108
  .removesuffix("(Today)")
109
+ .removesuffix("(Tomorrow)")
109
110
  .replace("&nbsp", " ")
110
111
  + " "
111
112
  + datetime.now().strftime("%Y"),
@@ -1,9 +1,11 @@
1
- import requests
2
1
  from bs4 import BeautifulSoup
2
+ from selenium.webdriver.common.by import By
3
+ from selenium.webdriver.support import expected_conditions as EC
4
+ from selenium.webdriver.support.wait import WebDriverWait
5
+
3
6
  from uk_bin_collection.uk_bin_collection.common import *
4
7
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
5
8
 
6
-
7
9
  # import the wonderful Beautiful Soup and the URL grabber
8
10
 
9
11
 
@@ -17,36 +19,72 @@ class CouncilClass(AbstractGetBinDataClass):
17
19
  def parse_data(self, page: str, **kwargs) -> dict:
18
20
  # Get postcode and UPRN from kwargs
19
21
  user_postcode = kwargs.get("postcode")
20
- user_uprn = kwargs.get("uprn")
22
+ user_paon = kwargs.get("paon")
23
+ web_driver = kwargs.get("web_driver")
24
+ headless = kwargs.get("headless")
21
25
  check_postcode(user_postcode)
22
- check_uprn(user_uprn)
26
+ check_paon(user_paon)
23
27
 
24
28
  # Build URL to parse
25
- council_url = f"https://swale.gov.uk/bins-littering-and-the-environment/bins/collection-days?postcode={user_postcode.replace(' ', '+')}&addresses={user_uprn}&address-submit="
29
+ council_url = "https://swale.gov.uk/bins-littering-and-the-environment/bins/my-collection-day"
30
+
31
+ # Create Selenium webdriver
32
+ driver = create_webdriver(web_driver, headless, None, __name__)
33
+ driver.get(council_url)
34
+
35
+ # Wait for the postcode field to appear then populate it
36
+ try:
37
+ inputElement_postcode = WebDriverWait(driver, 10).until(
38
+ EC.presence_of_element_located((By.ID, "q462406_q1"))
39
+ )
40
+ inputElement_postcode.send_keys(user_postcode)
41
+ except Exception:
42
+ print("Page failed to load. Probably due to Cloudflare robot check!")
43
+
44
+ # Click search button
45
+ findAddress = WebDriverWait(driver, 10).until(
46
+ EC.presence_of_element_located((By.ID, "form_email_462397_submit"))
47
+ )
48
+ driver.execute_script("arguments[0].click();", findAddress)
49
+
50
+ # Wait for the 'Select address' dropdown to appear and select option matching the house name/number
51
+ WebDriverWait(driver, 10).until(
52
+ EC.element_to_be_clickable(
53
+ (
54
+ By.XPATH,
55
+ "//select[@id='SBCYBDAddressList']//option[contains(., '"
56
+ + user_paon
57
+ + "')]",
58
+ )
59
+ )
60
+ ).click()
61
+
62
+ # Click search button
63
+ getBins = WebDriverWait(driver, 10).until(
64
+ EC.presence_of_element_located((By.ID, "form_email_462397_submit"))
65
+ )
66
+ driver.execute_script("arguments[0].click();", getBins)
67
+
68
+ BinTable = WebDriverWait(driver, 30).until(
69
+ EC.presence_of_element_located((By.ID, "SBC-YBD-Main"))
70
+ )
26
71
 
27
- # Parse URL and read if connection successful
28
- requests.packages.urllib3.disable_warnings()
29
- response = requests.get(council_url, verify=False)
30
- if response.status_code == 200:
31
- soup = BeautifulSoup(response.text, features="html.parser")
32
- soup.prettify()
33
- else:
34
- raise ConnectionAbortedError("Could not parse council website.")
72
+ soup = BeautifulSoup(driver.page_source, features="html.parser")
73
+ soup.prettify()
35
74
 
36
75
  data = {"bins": []}
37
76
 
38
77
  # Get the collection bullet points on the page and parse them
39
- form_area = soup.find("form", {"class": "integration bin-lookup"})
40
- collections = [
41
- item.text.strip().split(",") for item in form_area.find_all("li")
42
- ]
43
- for c in collections:
44
- bin_type = c[0].strip()
45
- # temp_date = c[2].strip() + " " + str(datetime.now().year)
46
- bin_date = datetime.strptime(
47
- c[2].strip() + " " + str(datetime.now().year), "%d %B %Y"
48
- ).strftime(date_format)
49
- dict_data = {"type": bin_type, "collectionDate": bin_date}
50
- data["bins"].append(dict_data)
78
+ nextCollections = soup.find("div", {"id": "nextCollections"})
79
+ for c in nextCollections:
80
+ collection = c.find_all("strong")
81
+ for bin in collection:
82
+ split = (bin.text).split(" on ")
83
+ bin_type = split[0]
84
+ bin_date = datetime.strptime(split[1], "%A %d %b %Y").strftime(
85
+ "%d/%m/%Y"
86
+ )
87
+ dict_data = {"type": bin_type, "collectionDate": bin_date}
88
+ data["bins"].append(dict_data)
51
89
 
52
90
  return data
@@ -10,7 +10,6 @@ from selenium.webdriver.common.keys import Keys
10
10
  from selenium.webdriver.support import expected_conditions as EC
11
11
  from selenium.webdriver.support.ui import Select
12
12
  from selenium.webdriver.support.wait import WebDriverWait
13
- from uk_bin_collection.uk_bin_collection.common import *
14
13
 
15
14
  from uk_bin_collection.uk_bin_collection.common import *
16
15
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
@@ -91,9 +90,10 @@ class CouncilClass(AbstractGetBinDataClass):
91
90
  if len(cols) == 2:
92
91
  bin_types = [img["alt"] for img in cols[0].find_all("img")]
93
92
  collection_date_str = cols[1].text
94
- collection_date = datetime.strptime(
95
- collection_date_str, "%A %dth %B"
93
+ collection_date_str = remove_ordinal_indicator_from_date_string(
94
+ collection_date_str
96
95
  )
96
+ collection_date = datetime.strptime(collection_date_str, "%A %d %B")
97
97
  collection_date = collection_date.replace(
98
98
  year=2024
99
99
  ) # Assuming the year is 2024
@@ -1,5 +1,6 @@
1
1
  import requests
2
2
  from bs4 import BeautifulSoup
3
+
3
4
  from uk_bin_collection.uk_bin_collection.common import *
4
5
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
5
6
 
@@ -89,11 +90,7 @@ class CouncilClass(AbstractGetBinDataClass):
89
90
  raise ValueError(f"Error parsing bin data: {ex}")
90
91
 
91
92
  # Build data dict for each entry
92
- dict_data = {
93
- "type": bin_type,
94
- "collectionDate": bin_date,
95
- "colour": bin_colour,
96
- }
93
+ dict_data = {"type": bin_type, "collectionDate": bin_date}
97
94
  data["bins"].append(dict_data)
98
95
 
99
96
  data["bins"].sort(
@@ -74,30 +74,51 @@ class CouncilClass(AbstractGetBinDataClass):
74
74
  soup = BeautifulSoup(driver.page_source, features="html.parser")
75
75
  soup.prettify()
76
76
 
77
- rubbish_date = datetime.strptime(
78
- " ".join(
79
- soup.find("div", {"id": "FINDYOURBINDAYS_RUBBISHDATE_OUTERDIV"})
80
- .get_text(strip=True)
81
- .split()[6:8]
82
- ),
83
- "%d %B",
84
- ).replace(year=datetime.now().year)
85
- recycling_date = datetime.strptime(
86
- " ".join(
87
- soup.find("div", {"id": "FINDYOURBINDAYS_RECYCLINGDATE_OUTERDIV"})
88
- .get_text(strip=True)
89
- .split()[6:8]
90
- ),
91
- "%d %B",
92
- ).replace(year=datetime.now().year)
93
- food_date = datetime.strptime(
94
- " ".join(
95
- soup.find("div", {"id": "FINDYOURBINDAYS_FOODWASTEDATE_OUTERDIV"})
96
- .get_text(strip=True)
97
- .split()[8:10]
98
- ),
99
- "%d %B",
100
- ).replace(year=datetime.now().year)
77
+ rubbish_div = soup.find(
78
+ "div", {"id": "FINDYOURBINDAYS_RUBBISHDATE_OUTERDIV"}
79
+ )
80
+ try:
81
+ rubbish_date = rubbish_div.find_all("div")[2]
82
+ rubbish_date = datetime.strptime(
83
+ rubbish_date.text,
84
+ "%A %d %B",
85
+ ).replace(year=datetime.now().year)
86
+ except:
87
+ rubbish_date = rubbish_div.find_all("div")[3]
88
+ rubbish_date = datetime.strptime(
89
+ rubbish_date.text,
90
+ "%A %d %B",
91
+ ).replace(year=datetime.now().year)
92
+ recycling_div = soup.find(
93
+ "div", {"id": "FINDYOURBINDAYS_RECYCLINGDATE_OUTERDIV"}
94
+ )
95
+ try:
96
+ recycling_date = recycling_div.find_all("div")[2]
97
+ recycling_date = datetime.strptime(
98
+ recycling_date.text,
99
+ "%A %d %B",
100
+ ).replace(year=datetime.now().year)
101
+ except:
102
+ rubbish_date = recycling_div.find_all("div")[3]
103
+ rubbish_date = datetime.strptime(
104
+ rubbish_date.text,
105
+ "%A %d %B",
106
+ ).replace(year=datetime.now().year)
107
+ food_div = soup.find(
108
+ "div", {"id": "FINDYOURBINDAYS_RECYCLINGDATE_OUTERDIV"}
109
+ )
110
+ try:
111
+ food_date = food_div.find_all("div")[2]
112
+ food_date = datetime.strptime(
113
+ food_date.text,
114
+ "%A %d %B",
115
+ ).replace(year=datetime.now().year)
116
+ except:
117
+ food_date = food_div.find_all("div")[3]
118
+ food_date = datetime.strptime(
119
+ food_date.text,
120
+ "%A %d %B",
121
+ ).replace(year=datetime.now().year)
101
122
 
102
123
  if datetime.now().month == 12 and rubbish_date.month == 1:
103
124
  rubbish_date = rubbish_date + relativedelta(years=1)
@@ -65,7 +65,6 @@ class CouncilClass(AbstractGetBinDataClass):
65
65
 
66
66
  dict_data = {
67
67
  "type": bin_name_clean,
68
- "colour": bin_colour,
69
68
  "collectionDate": next_collection.strftime(date_format),
70
69
  }
71
70
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uk_bin_collection
3
- Version: 0.98.3
3
+ Version: 0.98.5
4
4
  Summary: Python Lib to collect UK Bin Data
5
5
  Author: Robert Bradley
6
6
  Author-email: robbrad182@gmail.com
@@ -2,7 +2,7 @@ uk_bin_collection/README.rst,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
2
2
  uk_bin_collection/tests/council_feature_input_parity.py,sha256=DO6Mk4ImYgM5ZCZ-cutwz5RoYYWZRLYx2tr6zIs_9Rc,3843
3
3
  uk_bin_collection/tests/features/environment.py,sha256=VQZjJdJI_kZn08M0j5cUgvKT4k3iTw8icJge1DGOkoA,127
4
4
  uk_bin_collection/tests/features/validate_council_outputs.feature,sha256=SJK-Vc737hrf03tssxxbeg_JIvAH-ddB8f6gU1LTbuQ,251
5
- uk_bin_collection/tests/input.json,sha256=Lb2LZ6Q1LvG-yaG4KCjPIiKdLyK9IE6N_4vb7wwdExw,68074
5
+ uk_bin_collection/tests/input.json,sha256=gkqIfeMzQQC76jc6J4DPRn1ZCp6AVdPU_7ra3gb7pyc,68114
6
6
  uk_bin_collection/tests/output.schema,sha256=ZwKQBwYyTDEM4G2hJwfLUVM-5v1vKRvRK9W9SS1sd18,1086
7
7
  uk_bin_collection/tests/step_defs/step_helpers/file_handler.py,sha256=Ygzi4V0S1MIHqbdstUlIqtRIwnynvhu4UtpweJ6-5N8,1474
8
8
  uk_bin_collection/tests/step_defs/test_validate_council.py,sha256=LrOSt_loA1Mw3vTqaO2LpaDMu7rYJy6k5Kr-EOBln7s,3424
@@ -17,7 +17,7 @@ uk_bin_collection/uk_bin_collection/councils/ArmaghBanbridgeCraigavonCouncil.py,
17
17
  uk_bin_collection/uk_bin_collection/councils/ArunCouncil.py,sha256=yfhthv9nuogP19VOZ3TYQrq51qqjiCZcSel4sXhiKjs,4012
18
18
  uk_bin_collection/uk_bin_collection/councils/AylesburyValeCouncil.py,sha256=LouqjspEMt1TkOGqWHs2zkxwOETIy3n7p64uKIlAgUg,2401
19
19
  uk_bin_collection/uk_bin_collection/councils/BCPCouncil.py,sha256=W7QBx6Mgso8RYosuXsaYo3GGNAu-tiyBSmuYxr1JSOU,1707
20
- uk_bin_collection/uk_bin_collection/councils/BarnetCouncil.py,sha256=NccMd0830aiNRQ8SH6mc4r5Hlugfey5-PyUd24QLo4s,8478
20
+ uk_bin_collection/uk_bin_collection/councils/BarnetCouncil.py,sha256=Sd4-pbv0QZsR7soxvXYqsfdOUIqZqS6notyoZthG77s,9182
21
21
  uk_bin_collection/uk_bin_collection/councils/BarnsleyMBCouncil.py,sha256=MgF_7XyIcIoNzFR0OJsjBkLCZKgWxBrV6nTcutMxO1Q,4244
22
22
  uk_bin_collection/uk_bin_collection/councils/BasildonCouncil.py,sha256=SBvAa0GZM3V7ygK8ARawbHAPH6R_303U30RH8WYPi5Q,3020
23
23
  uk_bin_collection/uk_bin_collection/councils/BasingstokeCouncil.py,sha256=VPWGljnH4C3q8qs5ZmCtqjNjgWQvviALzjk00q3EZeQ,2632
@@ -30,7 +30,7 @@ uk_bin_collection/uk_bin_collection/councils/BirminghamCityCouncil.py,sha256=now
30
30
  uk_bin_collection/uk_bin_collection/councils/BlackburnCouncil.py,sha256=jHbCK8sL09vdmdP7Xnh8lIrU5AHTnJLEZfOLephPvWg,4090
31
31
  uk_bin_collection/uk_bin_collection/councils/BoltonCouncil.py,sha256=r7wjrRPT2EinRMnYjGxmsCD6aMFhEOyRNd8_3R9PdQU,4117
32
32
  uk_bin_collection/uk_bin_collection/councils/BracknellForestCouncil.py,sha256=Llo1rULaAZ8rChVYZqXFFLo7CN6vbT0ULUJD6ActouY,9015
33
- uk_bin_collection/uk_bin_collection/councils/BradfordMDC.py,sha256=9EDTdhbGb8BQ5PLEw9eiWZ3BrS0TtoFpYOHQU44wc2k,4308
33
+ uk_bin_collection/uk_bin_collection/councils/BradfordMDC.py,sha256=VFrdcqKpHPw8v77Ll9QzBz_4carUfC1XYnxqUvDihkA,4275
34
34
  uk_bin_collection/uk_bin_collection/councils/BrightonandHoveCityCouncil.py,sha256=k6qt4cds-Ejd97Z-__pw2BYvGVbFdc9SUfF73PPrTNA,5823
35
35
  uk_bin_collection/uk_bin_collection/councils/BristolCityCouncil.py,sha256=kJmmDJz_kQ45DHmG7ocrUpNJonEn0kuXYEDQyZaf9ks,5576
36
36
  uk_bin_collection/uk_bin_collection/councils/BromleyBoroughCouncil.py,sha256=_bAFykZWZkEVUB-QKeVLfWO8plG6nRgn71QF2BUN2rk,4329
@@ -78,10 +78,10 @@ uk_bin_collection/uk_bin_collection/councils/FenlandDistrictCouncil.py,sha256=sF
78
78
  uk_bin_collection/uk_bin_collection/councils/ForestOfDeanDistrictCouncil.py,sha256=xO5gqgsN9K-cQsuDoQF7ycZkjNdCPAQwIYOCFWxFJ_Y,4504
79
79
  uk_bin_collection/uk_bin_collection/councils/GatesheadCouncil.py,sha256=SRCgYhYs6rv_8C1UEDVORHZgXxcJkoZBjzdYS4Lu-ew,4531
80
80
  uk_bin_collection/uk_bin_collection/councils/GedlingBoroughCouncil.py,sha256=IssL5CJSdcGPkJCB0q2kieUSEjfoS6nDKfeT7-9eKsQ,2183
81
- uk_bin_collection/uk_bin_collection/councils/GlasgowCityCouncil.py,sha256=IOgM8Wl-LpO1T-F9uU1FlVfPaEObpvsdP7S2h03Mycc,2528
81
+ uk_bin_collection/uk_bin_collection/councils/GlasgowCityCouncil.py,sha256=i7BympEhCm7D9yR0p5_QQICtWvNcDYNJIWB19SA0g2k,2303
82
82
  uk_bin_collection/uk_bin_collection/councils/GloucesterCityCouncil.py,sha256=8Wjvmdvg5blHVrREaEnhhWZaWhYVP4v_KdDVPLIUxaU,4889
83
83
  uk_bin_collection/uk_bin_collection/councils/GuildfordCouncil.py,sha256=9pVrmQhZcK2AD8gX8mNvP--L4L9KaY6L3B822VX6fec,5695
84
- uk_bin_collection/uk_bin_collection/councils/HaltonBoroughCouncil.py,sha256=r8cmtWhMJg-XG63ZHxidKKW7i4yQNrZSSMSCkBwrqjI,5837
84
+ uk_bin_collection/uk_bin_collection/councils/HaltonBoroughCouncil.py,sha256=gq_CPqi6qM2oNiHhKKF1lZC86fyKL4lPhh_DN9pJZ04,5971
85
85
  uk_bin_collection/uk_bin_collection/councils/HaringeyCouncil.py,sha256=t_6AkAu4wrv8Q0WlDhWh_82I0djl5tk531Pzs-SjWzg,2647
86
86
  uk_bin_collection/uk_bin_collection/councils/HarrogateBoroughCouncil.py,sha256=_g3fP5Nq-OUjgNrfRf4UEyFKzq0x8QK-4enh5RP1efA,2050
87
87
  uk_bin_collection/uk_bin_collection/councils/HighPeakCouncil.py,sha256=oqF8M0lcT3KsrG6W6I6JJX07E6Sc_-_sr7MybfIMab8,4626
@@ -105,14 +105,14 @@ uk_bin_collection/uk_bin_collection/councils/LondonBoroughLambeth.py,sha256=r9D5
105
105
  uk_bin_collection/uk_bin_collection/councils/LondonBoroughRedbridge.py,sha256=A_6Sis5hsF53Th04KeadHRasGbpAm6aoaWJ6X8eC4Y8,6604
106
106
  uk_bin_collection/uk_bin_collection/councils/MaldonDistrictCouncil.py,sha256=PMVt2XFggttPmbWyrBrHJ-W6R_6-0ux1BkY1kj1IKzg,1997
107
107
  uk_bin_collection/uk_bin_collection/councils/MalvernHillsDC.py,sha256=iQG0EkX2npBicvsGKQRYyBGSBvKVUbKvUvvwrC9xV1A,2100
108
- uk_bin_collection/uk_bin_collection/councils/ManchesterCityCouncil.py,sha256=RFXC4bRDYZgeFIzfsOWZXoBEWV7mNiM0HejhcPsP3a0,4920
108
+ uk_bin_collection/uk_bin_collection/councils/ManchesterCityCouncil.py,sha256=RY301_82z3-xInGai5ocT7rzoV75ATbf0N7uxn8Z9LE,3110
109
109
  uk_bin_collection/uk_bin_collection/councils/MansfieldDistrictCouncil.py,sha256=F5AiTxImrnjE1k3ry96bfstOf5XSNBJS_4qqmymmh3w,1386
110
110
  uk_bin_collection/uk_bin_collection/councils/MertonCouncil.py,sha256=3Y2Un4xXo1sCcMsudynODSzocV_mMofWkX2JqONDb5o,1997
111
111
  uk_bin_collection/uk_bin_collection/councils/MidAndEastAntrimBoroughCouncil.py,sha256=oOWwU5FSgGej2Mv7FQ66N-EzS5nZgmGsd0WnfLWUc1I,5238
112
112
  uk_bin_collection/uk_bin_collection/councils/MidSussexDistrictCouncil.py,sha256=AZgC9wmDLEjUOtIFvf0ehF5LHturXTH4DkE3ioPSVBA,6254
113
113
  uk_bin_collection/uk_bin_collection/councils/MiltonKeynesCityCouncil.py,sha256=3olsWa77L34vz-c7NgeGK9xmNuR4Ws_oAk5D4UpIkPw,2005
114
114
  uk_bin_collection/uk_bin_collection/councils/MoleValleyDistrictCouncil.py,sha256=bvCrC4Qcg0Uzp9zZGcC7-7-oJcMh2cb1VaXfdkB11oc,5257
115
- uk_bin_collection/uk_bin_collection/councils/NeathPortTalbotCouncil.py,sha256=V9URKAv3dA_deYmStL2Nmn4GbVCM-tU2qnKobivmGew,5583
115
+ uk_bin_collection/uk_bin_collection/councils/NeathPortTalbotCouncil.py,sha256=ychYR2nsyk2UIb8tjWaKrLUT4hxSsHN558l3RqZ0mjw,5635
116
116
  uk_bin_collection/uk_bin_collection/councils/NewForestCouncil.py,sha256=ylTn9KmWITtaO9_Z8kJCN2w2ALfhrfGt3SeJ78lgw7M,5391
117
117
  uk_bin_collection/uk_bin_collection/councils/NewarkAndSherwoodDC.py,sha256=lAleYfCGUWCKOi7Ye_cjgfpI3pWwTcFctlYmh0hjebM,2140
118
118
  uk_bin_collection/uk_bin_collection/councils/NewcastleCityCouncil.py,sha256=eJMX10CG9QO7FRhHSmUDL-jO_44qoK3_1ztNTAXhkbw,2085
@@ -170,7 +170,7 @@ uk_bin_collection/uk_bin_collection/councils/StokeOnTrentCityCouncil.py,sha256=K
170
170
  uk_bin_collection/uk_bin_collection/councils/StratfordUponAvonCouncil.py,sha256=DMTAcXT_lay8Cl1hBbzf_LN7-GwTDGxT3Ug9QJkaF9Y,3936
171
171
  uk_bin_collection/uk_bin_collection/councils/StroudDistrictCouncil.py,sha256=9bYWppi7ViLGHL4VEg--nFn28MLYJYbiEntull1uZxU,3561
172
172
  uk_bin_collection/uk_bin_collection/councils/SunderlandCityCouncil.py,sha256=4DnKyyu56_AwuchD6_oL1dvpDStMvkkxQtYN79rUKOs,3825
173
- uk_bin_collection/uk_bin_collection/councils/SwaleBoroughCouncil.py,sha256=CCAjclhkCxwf_MkdrIif7MZpLfV5SPy7hyM7BE0TRPc,2048
173
+ uk_bin_collection/uk_bin_collection/councils/SwaleBoroughCouncil.py,sha256=ak0zqBJ6UAS8_t5zKGwigMxPMdlQuYXRsGCQJCNERJs,3415
174
174
  uk_bin_collection/uk_bin_collection/councils/SwanseaCouncil.py,sha256=nmVPoPhnFgVi--vczX2i4Sf3bqM5RWJuwfhioRUr5XE,2303
175
175
  uk_bin_collection/uk_bin_collection/councils/TamesideMBCouncil.py,sha256=k2TAAZG7n2S1BWVyxbE_-4-lZuzhOimCNz4yimUCOGk,1995
176
176
  uk_bin_collection/uk_bin_collection/councils/TandridgeDistrictCouncil.py,sha256=KLVvM2NNq_DQylVe5dwO2l7qPahLHg08jJGLCv1MBQ4,2324
@@ -181,9 +181,9 @@ uk_bin_collection/uk_bin_collection/councils/ThreeRiversDistrictCouncil.py,sha25
181
181
  uk_bin_collection/uk_bin_collection/councils/TonbridgeAndMallingBC.py,sha256=UlgnHDoi8ecav2H5-HqKNDpqW1J3RN-c___5c08_Q7I,4859
182
182
  uk_bin_collection/uk_bin_collection/councils/TorbayCouncil.py,sha256=JW_BS7wkfxFsmx6taQtPAQWdBp1AfLrxs0XRQ2XZcSw,2029
183
183
  uk_bin_collection/uk_bin_collection/councils/TorridgeDistrictCouncil.py,sha256=6gOO02pYU0cbj3LAHiBVNG4zkFMyIGbkE2jAye3KcGM,6386
184
- uk_bin_collection/uk_bin_collection/councils/UttlesfordDistrictCouncil.py,sha256=8CvO-WgdKdvyaOf3TYc4XwME8ogAXojgB40oyGRL8Dw,4129
184
+ uk_bin_collection/uk_bin_collection/councils/UttlesfordDistrictCouncil.py,sha256=GSELWbSn5jtznv6FSLIMxK6CyQ27MW9FoY_m5jhTEBA,4175
185
185
  uk_bin_collection/uk_bin_collection/councils/ValeofGlamorganCouncil.py,sha256=Phgb_ECiUOOkqOx6OsfsTHMCW5VQfRmOC2zgYIQhuZA,5044
186
- uk_bin_collection/uk_bin_collection/councils/ValeofWhiteHorseCouncil.py,sha256=5nZLbU5YVKNsJ2X_wuybrNLFAzjVAxkazu-bYP4IGXw,4292
186
+ uk_bin_collection/uk_bin_collection/councils/ValeofWhiteHorseCouncil.py,sha256=KBKGHcWAdPC_8-CfKnLOdP7Ww6RIvlxLIJGqBsq_77g,4208
187
187
  uk_bin_collection/uk_bin_collection/councils/WakefieldCityCouncil.py,sha256=-xqJOzHTrT4jOB3rHPXFYeqLaHyK9XmCPi92whaYBhw,4671
188
188
  uk_bin_collection/uk_bin_collection/councils/WalsallCouncil.py,sha256=_anovUnXMr40lZLHyX3opIP73BwauCllKy-Z2SBrzPw,2076
189
189
  uk_bin_collection/uk_bin_collection/councils/WalthamForest.py,sha256=P7MMw0EhpRmDbbnHb25tY5_yvYuZUFwJ1br4TOv24sY,4997
@@ -191,12 +191,12 @@ uk_bin_collection/uk_bin_collection/councils/WarwickDistrictCouncil.py,sha256=3W
191
191
  uk_bin_collection/uk_bin_collection/councils/WaverleyBoroughCouncil.py,sha256=tp9l7vdgSGRzNNG0pDfnNuFj4D2bpRJUJmAiTJ6bM0g,4662
192
192
  uk_bin_collection/uk_bin_collection/councils/WealdenDistrictCouncil.py,sha256=SvSSaLkx7iJjzypAwKkaJwegXkSsIQtUOS2V605kz1A,3368
193
193
  uk_bin_collection/uk_bin_collection/councils/WelhatCouncil.py,sha256=ikUft37dYNJghfe-_6Fskiq1JihqpLmLNj38QkKSUUA,2316
194
- uk_bin_collection/uk_bin_collection/councils/WestBerkshireCouncil.py,sha256=r90AIUdPgo85VuuvN_NeCDUy3NEJXdO4Ntt93yKo6qI,5110
194
+ uk_bin_collection/uk_bin_collection/councils/WestBerkshireCouncil.py,sha256=XhTimZAPNgcuFgNp5mQjkR8mC4LRqUEUCy6e6plHspM,6004
195
195
  uk_bin_collection/uk_bin_collection/councils/WestLindseyDistrictCouncil.py,sha256=JFWUy4w0CKulGq16PfbRDKAdQEbokVEuabwlZYigdEU,4606
196
196
  uk_bin_collection/uk_bin_collection/councils/WestLothianCouncil.py,sha256=dq0jimtARvRkZiGbVFrXXZgY-BODtz3uYZ5UKn0bf64,4114
197
197
  uk_bin_collection/uk_bin_collection/councils/WestMorlandAndFurness.py,sha256=jbqV3460rn9D0yTBGWjpSe1IvWWcdGur5pzgj-hJcQ4,2513
198
198
  uk_bin_collection/uk_bin_collection/councils/WestNorthamptonshireCouncil.py,sha256=F1GeJUGND4DN_HuM6N0Elpeb0DAMm9_KeqG6qtIgZf4,1079
199
- uk_bin_collection/uk_bin_collection/councils/WestSuffolkCouncil.py,sha256=HMFWxM7VMhBuC7iubNGbZYEoCVWi--gRHDJMVdPPFOM,2633
199
+ uk_bin_collection/uk_bin_collection/councils/WestSuffolkCouncil.py,sha256=9i8AQHh-qIRPZ_5Ad97_h04-qgyLQDPV064obBzab1Y,2587
200
200
  uk_bin_collection/uk_bin_collection/councils/WiganBoroughCouncil.py,sha256=3gqFA4-BVx_In6QOu3KUNqPN4Fkn9iMlZTeopMK9p6A,3746
201
201
  uk_bin_collection/uk_bin_collection/councils/WiltshireCouncil.py,sha256=it2Oh5Kmq3lD30gAZgk2bzZPNCtJcFHyQO1NgOQtfvU,5653
202
202
  uk_bin_collection/uk_bin_collection/councils/WinchesterCityCouncil.py,sha256=W2k00N5n9-1MzjMEqsNjldsQdOJPEPMjK7OGSinZm5Y,4335
@@ -210,8 +210,8 @@ uk_bin_collection/uk_bin_collection/councils/YorkCouncil.py,sha256=I2kBYMlsD4bId
210
210
  uk_bin_collection/uk_bin_collection/councils/council_class_template/councilclasstemplate.py,sha256=4s9ODGPAwPqwXc8SrTX5Wlfmizs3_58iXUtHc4Ir86o,1162
211
211
  uk_bin_collection/uk_bin_collection/create_new_council.py,sha256=m-IhmWmeWQlFsTZC4OxuFvtw5ZtB8EAJHxJTH4O59lQ,1536
212
212
  uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=YvmHfZqanwrJ8ToGch34x-L-7yPe31nB_x77_Mgl_vo,4545
213
- uk_bin_collection-0.98.3.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
214
- uk_bin_collection-0.98.3.dist-info/METADATA,sha256=tXTM95e75ygcLe_-4x6iPeWvmm7maK9V6VxrXjov5J0,16843
215
- uk_bin_collection-0.98.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
216
- uk_bin_collection-0.98.3.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
217
- uk_bin_collection-0.98.3.dist-info/RECORD,,
213
+ uk_bin_collection-0.98.5.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
214
+ uk_bin_collection-0.98.5.dist-info/METADATA,sha256=hbuONB_eNHQmV4S23Zggy6yYeSXl5wI-YQrWkYlld58,16843
215
+ uk_bin_collection-0.98.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
216
+ uk_bin_collection-0.98.5.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
217
+ uk_bin_collection-0.98.5.dist-info/RECORD,,