uk_bin_collection 0.146.0__py3-none-any.whl → 0.146.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- uk_bin_collection/uk_bin_collection/councils/Hillingdon.py +53 -32
- {uk_bin_collection-0.146.0.dist-info → uk_bin_collection-0.146.1.dist-info}/METADATA +1 -1
- {uk_bin_collection-0.146.0.dist-info → uk_bin_collection-0.146.1.dist-info}/RECORD +6 -6
- {uk_bin_collection-0.146.0.dist-info → uk_bin_collection-0.146.1.dist-info}/LICENSE +0 -0
- {uk_bin_collection-0.146.0.dist-info → uk_bin_collection-0.146.1.dist-info}/WHEEL +0 -0
- {uk_bin_collection-0.146.0.dist-info → uk_bin_collection-0.146.1.dist-info}/entry_points.txt +0 -0
@@ -35,41 +35,62 @@ DAYS_OF_WEEK = {
|
|
35
35
|
def get_bank_holiday_changes(driver: WebDriver) -> Dict[str, str]:
|
36
36
|
"""Fetch and parse bank holiday collection changes from the council website."""
|
37
37
|
bank_holiday_url = "https://www.hillingdon.gov.uk/bank-holiday-collections"
|
38
|
-
|
38
|
+
changes: Dict[str, str] = {}
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
wait.until(EC.presence_of_element_located((By.TAG_NAME, "table")))
|
40
|
+
try:
|
41
|
+
driver.get(bank_holiday_url)
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
# Check if the page is a 404 or has an error
|
44
|
+
if "404" in driver.title or "Page not found" in driver.page_source:
|
45
|
+
print("Bank holiday page not found (404).")
|
46
|
+
return changes
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
48
|
+
# Wait for page to load
|
49
|
+
wait = WebDriverWait(driver, 10)
|
50
|
+
try:
|
51
|
+
wait.until(EC.presence_of_element_located((By.TAG_NAME, "table")))
|
52
|
+
except TimeoutException:
|
53
|
+
print("No tables found on the bank holiday page.")
|
54
|
+
return changes
|
55
|
+
|
56
|
+
# Parse the page
|
57
|
+
soup = BeautifulSoup(driver.page_source, features="html.parser")
|
58
|
+
|
59
|
+
# Find all tables with collection changes
|
60
|
+
tables = soup.find_all("table")
|
61
|
+
if not tables:
|
62
|
+
print("No relevant tables found on the bank holiday page.")
|
63
|
+
return changes
|
64
|
+
|
65
|
+
for table in tables:
|
66
|
+
# Check if this is a collection changes table
|
67
|
+
headers = [th.text.strip() for th in table.find_all("th")]
|
68
|
+
if (
|
69
|
+
"Normal collection day" in headers
|
70
|
+
and "Revised collection day" in headers
|
71
|
+
):
|
72
|
+
# Process each row
|
73
|
+
for row in table.find_all("tr")[1:]: # Skip header row
|
74
|
+
cols = row.find_all("td")
|
75
|
+
if len(cols) >= 2:
|
76
|
+
normal_date = cols[0].text.strip()
|
77
|
+
revised_date = cols[1].text.strip()
|
78
|
+
|
79
|
+
# Parse dates
|
80
|
+
try:
|
81
|
+
normal_date = parse(normal_date, fuzzy=True).strftime(
|
82
|
+
"%d/%m/%Y"
|
83
|
+
)
|
84
|
+
revised_date = parse(revised_date, fuzzy=True).strftime(
|
85
|
+
"%d/%m/%Y"
|
86
|
+
)
|
87
|
+
changes[normal_date] = revised_date
|
88
|
+
except Exception as e:
|
89
|
+
print(f"Error parsing dates: {e}")
|
90
|
+
continue
|
91
|
+
|
92
|
+
except Exception as e:
|
93
|
+
print(f"An error occurred while fetching bank holiday changes: {e}")
|
73
94
|
|
74
95
|
return changes
|
75
96
|
|
@@ -148,7 +148,7 @@ uk_bin_collection/uk_bin_collection/councils/HerefordshireCouncil.py,sha256=JpQh
|
|
148
148
|
uk_bin_collection/uk_bin_collection/councils/HertsmereBoroughCouncil.py,sha256=ZbSsmqHStd2JtTMAq1Bhcvsj1BYp6ijELyOjZFX2GSw,6435
|
149
149
|
uk_bin_collection/uk_bin_collection/councils/HighPeakCouncil.py,sha256=x7dfy8mdt2iGl8qJxHb-uBh4u0knmi9MJ6irOJw9WYA,4805
|
150
150
|
uk_bin_collection/uk_bin_collection/councils/HighlandCouncil.py,sha256=GNxDU65QuZHV5va2IrKtcJ6TQoDdwmV03JvkVqOauP4,3291
|
151
|
-
uk_bin_collection/uk_bin_collection/councils/Hillingdon.py,sha256=
|
151
|
+
uk_bin_collection/uk_bin_collection/councils/Hillingdon.py,sha256=2OUp0iYO1YeZuTq0XRUalgoay5JRZgfHKKEwYzdMAU0,11291
|
152
152
|
uk_bin_collection/uk_bin_collection/councils/HinckleyandBosworthBoroughCouncil.py,sha256=51vXTKrstfJhb7cLCcrsvA9qKCsptyNMZvy7ML9DasM,2344
|
153
153
|
uk_bin_collection/uk_bin_collection/councils/HullCityCouncil.py,sha256=UHcesBoctFVcXDYuwfag43KbcJcopkEDzJ-54NxtK0Q,1851
|
154
154
|
uk_bin_collection/uk_bin_collection/councils/HuntingdonDistrictCouncil.py,sha256=dGyhhG6HRjQ2SPeiRwUPTGlk9dPIslagV2k0GjEOn1s,1587
|
@@ -332,8 +332,8 @@ uk_bin_collection/uk_bin_collection/councils/YorkCouncil.py,sha256=I2kBYMlsD4bId
|
|
332
332
|
uk_bin_collection/uk_bin_collection/councils/council_class_template/councilclasstemplate.py,sha256=QD4v4xpsEE0QheR_fGaNOIRMc2FatcUfKkkhAhseyVU,1159
|
333
333
|
uk_bin_collection/uk_bin_collection/create_new_council.py,sha256=m-IhmWmeWQlFsTZC4OxuFvtw5ZtB8EAJHxJTH4O59lQ,1536
|
334
334
|
uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=YvmHfZqanwrJ8ToGch34x-L-7yPe31nB_x77_Mgl_vo,4545
|
335
|
-
uk_bin_collection-0.146.
|
336
|
-
uk_bin_collection-0.146.
|
337
|
-
uk_bin_collection-0.146.
|
338
|
-
uk_bin_collection-0.146.
|
339
|
-
uk_bin_collection-0.146.
|
335
|
+
uk_bin_collection-0.146.1.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
|
336
|
+
uk_bin_collection-0.146.1.dist-info/METADATA,sha256=Q2CxbBh-CbGhd-HLj-lH0U3mDLxZWv3JgBXKMvaWNh0,19858
|
337
|
+
uk_bin_collection-0.146.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
338
|
+
uk_bin_collection-0.146.1.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
|
339
|
+
uk_bin_collection-0.146.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{uk_bin_collection-0.146.0.dist-info → uk_bin_collection-0.146.1.dist-info}/entry_points.txt
RENAMED
File without changes
|