uk_bin_collection 0.143.1__py3-none-any.whl → 0.143.2__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/AshfordBoroughCouncil.py +12 -5
- uk_bin_collection/uk_bin_collection/councils/EastHertsCouncil.py +4 -2
- uk_bin_collection/uk_bin_collection/councils/HertsmereBoroughCouncil.py +12 -4
- uk_bin_collection/uk_bin_collection/councils/LeedsCityCouncil.py +35 -53
- uk_bin_collection/uk_bin_collection/councils/WindsorAndMaidenheadCouncil.py +0 -1
- {uk_bin_collection-0.143.1.dist-info → uk_bin_collection-0.143.2.dist-info}/METADATA +1 -1
- {uk_bin_collection-0.143.1.dist-info → uk_bin_collection-0.143.2.dist-info}/RECORD +10 -10
- {uk_bin_collection-0.143.1.dist-info → uk_bin_collection-0.143.2.dist-info}/LICENSE +0 -0
- {uk_bin_collection-0.143.1.dist-info → uk_bin_collection-0.143.2.dist-info}/WHEEL +0 -0
- {uk_bin_collection-0.143.1.dist-info → uk_bin_collection-0.143.2.dist-info}/entry_points.txt +0 -0
@@ -21,7 +21,7 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
21
21
|
def parse_data(self, page: str, **kwargs) -> dict:
|
22
22
|
driver = None
|
23
23
|
try:
|
24
|
-
|
24
|
+
# Get and check UPRN
|
25
25
|
user_uprn = kwargs.get("uprn")
|
26
26
|
user_postcode = kwargs.get("postcode")
|
27
27
|
check_uprn(user_uprn)
|
@@ -73,7 +73,10 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
73
73
|
# Click search button
|
74
74
|
findAddress = WebDriverWait(driver, 10).until(
|
75
75
|
EC.presence_of_element_located(
|
76
|
-
(
|
76
|
+
(
|
77
|
+
By.ID,
|
78
|
+
"ContentPlaceHolder1_CollectionDayLookup2_Button_SelectAddress",
|
79
|
+
)
|
77
80
|
)
|
78
81
|
)
|
79
82
|
findAddress.click()
|
@@ -89,7 +92,9 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
89
92
|
bin_tables = soup.find_all("table")
|
90
93
|
|
91
94
|
for bin_table in bin_tables:
|
92
|
-
bin_text = bin_table.find(
|
95
|
+
bin_text = bin_table.find(
|
96
|
+
"td", id=re.compile("CollectionDayLookup2_td_")
|
97
|
+
)
|
93
98
|
if not bin_text:
|
94
99
|
continue
|
95
100
|
|
@@ -112,7 +117,9 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
112
117
|
if date_soup.text.strip().lower() == "today":
|
113
118
|
date = datetime.now().date()
|
114
119
|
else:
|
115
|
-
date = datetime.strptime(
|
120
|
+
date = datetime.strptime(
|
121
|
+
date_str.split(" ")[1], "%d/%m/%Y"
|
122
|
+
).date()
|
116
123
|
|
117
124
|
except ValueError:
|
118
125
|
continue
|
@@ -132,4 +139,4 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
132
139
|
# This block ensures that the driver is closed regardless of an exception
|
133
140
|
if driver:
|
134
141
|
driver.quit()
|
135
|
-
return bindata
|
142
|
+
return bindata
|
@@ -89,7 +89,9 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
89
89
|
property.click()
|
90
90
|
|
91
91
|
upcoming_scheduled_collections = WebDriverWait(driver, 10).until(
|
92
|
-
EC.presence_of_element_located(
|
92
|
+
EC.presence_of_element_located(
|
93
|
+
(By.ID, "upcoming-scheduled-collections")
|
94
|
+
)
|
93
95
|
)
|
94
96
|
|
95
97
|
soup = BeautifulSoup(driver.page_source, features="html.parser")
|
@@ -125,4 +127,4 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
125
127
|
# This block ensures that the driver is closed regardless of an exception
|
126
128
|
if driver:
|
127
129
|
driver.quit()
|
128
|
-
return bindata
|
130
|
+
return bindata
|
@@ -48,7 +48,11 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
48
48
|
for tag in strong:
|
49
49
|
parent = tag.parent
|
50
50
|
bin_type = (
|
51
|
-
(parent.text)
|
51
|
+
(parent.text)
|
52
|
+
.split("-")[1]
|
53
|
+
.strip()
|
54
|
+
.replace("\xa0", " ")
|
55
|
+
.split(" and ")
|
52
56
|
)
|
53
57
|
for bin in bin_type:
|
54
58
|
dict_data = {
|
@@ -104,7 +108,9 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
104
108
|
table_data = []
|
105
109
|
for row in table.find("tbody").find_all("tr"):
|
106
110
|
# Extract cell data from each <td> tag
|
107
|
-
row_data = [
|
111
|
+
row_data = [
|
112
|
+
cell.get_text(strip=True) for cell in row.find_all("td")
|
113
|
+
]
|
108
114
|
table_data.append(row_data)
|
109
115
|
|
110
116
|
else:
|
@@ -112,7 +118,9 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
112
118
|
|
113
119
|
collection_day = (table_data[0])[1]
|
114
120
|
|
115
|
-
current_week_bins = [
|
121
|
+
current_week_bins = [
|
122
|
+
bin for bin in bin_weeks if bin["week"] == current_week
|
123
|
+
]
|
116
124
|
next_week_bins = [bin for bin in bin_weeks if bin["week"] != current_week]
|
117
125
|
|
118
126
|
days_of_week = [
|
@@ -168,4 +176,4 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
168
176
|
# This block ensures that the driver is closed regardless of an exception
|
169
177
|
if driver:
|
170
178
|
driver.quit()
|
171
|
-
return bindata
|
179
|
+
return bindata
|
@@ -43,88 +43,70 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
43
43
|
postcode_box = wait.until(
|
44
44
|
EC.element_to_be_clickable(
|
45
45
|
(
|
46
|
-
By.
|
47
|
-
"
|
46
|
+
By.XPATH,
|
47
|
+
"//input[@id='postcode']",
|
48
48
|
)
|
49
49
|
)
|
50
50
|
)
|
51
51
|
postcode_box.send_keys(user_postcode)
|
52
52
|
postcode_btn_present = wait.until(
|
53
53
|
EC.presence_of_element_located(
|
54
|
-
(
|
55
|
-
By.ID,
|
56
|
-
"ctl00_ctl48_g_eea1a8ba_4306_488e_96f2_97f22038e29f_ctl00_btnSearchAddress",
|
57
|
-
)
|
58
|
-
)
|
59
|
-
)
|
60
|
-
postcode_btn = wait.until(
|
61
|
-
EC.element_to_be_clickable(
|
62
54
|
(
|
63
55
|
By.XPATH,
|
64
|
-
'
|
56
|
+
"//button[contains(text(),'Look up Address')]",
|
65
57
|
)
|
66
58
|
)
|
67
59
|
)
|
68
|
-
|
69
|
-
postcode_btn.send_keys(Keys.ENTER)
|
60
|
+
postcode_btn_present.click()
|
70
61
|
|
71
62
|
dropdown_present = wait.until(
|
72
63
|
EC.presence_of_element_located(
|
73
64
|
(
|
74
65
|
By.XPATH,
|
75
|
-
'
|
76
|
-
)
|
77
|
-
)
|
78
|
-
)
|
79
|
-
address_dropdown = wait.until(
|
80
|
-
EC.element_to_be_clickable(
|
81
|
-
(
|
82
|
-
By.ID,
|
83
|
-
"ctl00_ctl48_g_eea1a8ba_4306_488e_96f2_97f22038e29f_ctl00_ddlAddressList",
|
66
|
+
'//option[contains(text(),"Select an address")]/parent::select',
|
84
67
|
)
|
85
68
|
)
|
86
69
|
)
|
87
70
|
|
88
|
-
dropdown_present
|
71
|
+
dropdown_select = Select(dropdown_present)
|
72
|
+
|
73
|
+
dropdown_select.select_by_value(user_uprn)
|
89
74
|
|
90
|
-
|
91
|
-
dropdownSelect.select_by_value(str(user_uprn))
|
92
|
-
results = wait.until(
|
75
|
+
result = wait.until(
|
93
76
|
EC.presence_of_element_located(
|
94
77
|
(
|
95
|
-
By.
|
96
|
-
"
|
78
|
+
By.XPATH,
|
79
|
+
"//div[@class='lcc-bins']",
|
97
80
|
)
|
98
81
|
)
|
99
82
|
)
|
100
83
|
|
101
84
|
data = {"bins": []} # dictionary for data
|
102
|
-
soup = BeautifulSoup(
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
for bin_collection_dates in bin_types:
|
107
|
-
|
108
|
-
bin_collection_list = bin_collection_dates.find_all("li")
|
109
|
-
|
110
|
-
if bin_collection_list:
|
111
|
-
collection_dates = [
|
112
|
-
date.text.strip() for date in bin_collection_list
|
113
|
-
]
|
114
|
-
|
115
|
-
# Convert the collection dates to the desired format
|
116
|
-
formatted_dates = [
|
117
|
-
datetime.strptime(date, "%A %d %b %Y").strftime(date_format)
|
118
|
-
for date in collection_dates
|
119
|
-
]
|
120
|
-
|
121
|
-
# Extract the type of bin from the header
|
122
|
-
bin_type = bin_collection_dates.find_previous("h3").text.split()[0]
|
85
|
+
soup = BeautifulSoup(
|
86
|
+
result.get_attribute("innerHTML"), features="html.parser"
|
87
|
+
)
|
123
88
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
89
|
+
bin_sections = soup.select("div.lcc-bin:not(.lcc-bin--calendar)")
|
90
|
+
|
91
|
+
for section in bin_sections:
|
92
|
+
h3_text = section.find("h3").get_text(strip=True)
|
93
|
+
bin_type = h3_text.split()[0] # e.g., 'Black', 'Brown', 'Green'
|
94
|
+
|
95
|
+
# Find all <li> elements inside the bin days list
|
96
|
+
date_elements = section.select("div.lcc-bin__days li")
|
97
|
+
for li in date_elements:
|
98
|
+
raw_date = li.get_text(strip=True)
|
99
|
+
if not raw_date:
|
100
|
+
continue
|
101
|
+
try:
|
102
|
+
formatted_date = datetime.strptime(
|
103
|
+
raw_date, "%A %d %b %Y"
|
104
|
+
).strftime(date_format)
|
105
|
+
data["bins"].append(
|
106
|
+
{"type": bin_type, "collectionDate": formatted_date}
|
107
|
+
)
|
108
|
+
except ValueError:
|
109
|
+
print(f"Skipping unparseable date: {raw_date}")
|
128
110
|
except Exception as e:
|
129
111
|
# Here you can log the exception if needed
|
130
112
|
print(f"An error occurred: {e}")
|
@@ -23,7 +23,7 @@ uk_bin_collection/uk_bin_collection/councils/ArgyllandButeCouncil.py,sha256=fJ0U
|
|
23
23
|
uk_bin_collection/uk_bin_collection/councils/ArmaghBanbridgeCraigavonCouncil.py,sha256=o9NBbVCTdxKXnpYbP8-zxe1Gh8s57vwfV75Son_sAHE,2863
|
24
24
|
uk_bin_collection/uk_bin_collection/councils/ArunCouncil.py,sha256=yfhthv9nuogP19VOZ3TYQrq51qqjiCZcSel4sXhiKjs,4012
|
25
25
|
uk_bin_collection/uk_bin_collection/councils/AshfieldDistrictCouncil.py,sha256=fhX7S_A3jqoND7NE6qITPMPvdk3FJSKZ3Eoa5RtSg3I,4247
|
26
|
-
uk_bin_collection/uk_bin_collection/councils/AshfordBoroughCouncil.py,sha256=
|
26
|
+
uk_bin_collection/uk_bin_collection/councils/AshfordBoroughCouncil.py,sha256=kuL7ujTdbuvExy84Wl2LVrPlcmnpU-mgBIW3krEBXew,5227
|
27
27
|
uk_bin_collection/uk_bin_collection/councils/AylesburyValeCouncil.py,sha256=LouqjspEMt1TkOGqWHs2zkxwOETIy3n7p64uKIlAgUg,2401
|
28
28
|
uk_bin_collection/uk_bin_collection/councils/BCPCouncil.py,sha256=W7QBx6Mgso8RYosuXsaYo3GGNAu-tiyBSmuYxr1JSOU,1707
|
29
29
|
uk_bin_collection/uk_bin_collection/councils/BaberghDistrictCouncil.py,sha256=1eXdST58xFRMdYl8AGNG_EwyQeLa31WSWUe882hQ2ec,6329
|
@@ -101,7 +101,7 @@ uk_bin_collection/uk_bin_collection/councils/EalingCouncil.py,sha256=UhNXGi-_6NY
|
|
101
101
|
uk_bin_collection/uk_bin_collection/councils/EastAyrshireCouncil.py,sha256=i3AcWkeAnk7rD59nOm0QCSH7AggqjUAdwsXuSIC8ZJE,1614
|
102
102
|
uk_bin_collection/uk_bin_collection/councils/EastCambridgeshireCouncil.py,sha256=aYUVE5QqTxdj8FHhCB4EiFVDJahWJD9Pq0d1upBEvXg,1501
|
103
103
|
uk_bin_collection/uk_bin_collection/councils/EastDevonDC.py,sha256=U0VwSNIldMv5nUoiXtFgjbE0m6Kb-8W2WZQGVCNF_WI,3261
|
104
|
-
uk_bin_collection/uk_bin_collection/councils/EastHertsCouncil.py,sha256=
|
104
|
+
uk_bin_collection/uk_bin_collection/councils/EastHertsCouncil.py,sha256=FsHfejTGPjRUByDz157690LTD8JpqGplD_XVb7pTe3A,4862
|
105
105
|
uk_bin_collection/uk_bin_collection/councils/EastLindseyDistrictCouncil.py,sha256=RSOTD1MIXSW27eGf3TixCiJK4HtSJnpfME2CjalDeXs,4326
|
106
106
|
uk_bin_collection/uk_bin_collection/councils/EastLothianCouncil.py,sha256=zTp-GDWYeUIlFaqfkqGvo7XMtxJd0VbxdGgqaAwRACk,2792
|
107
107
|
uk_bin_collection/uk_bin_collection/councils/EastRenfrewshireCouncil.py,sha256=5giegMCKQ2JhVDR5M4mevVxIdhZtSW7kbuuoSkj3EGk,4361
|
@@ -142,7 +142,7 @@ uk_bin_collection/uk_bin_collection/councils/HartDistrictCouncil.py,sha256=_llxT
|
|
142
142
|
uk_bin_collection/uk_bin_collection/councils/HartlepoolBoroughCouncil.py,sha256=MUT1A24iZShT2p55rXEvgYwGUuw3W05Z4ZQAveehv-s,2842
|
143
143
|
uk_bin_collection/uk_bin_collection/councils/HastingsBoroughCouncil.py,sha256=9MCuit4awXSZTbZCXWBsQGX2tp2mHZ1eP1wENZdMvgA,1806
|
144
144
|
uk_bin_collection/uk_bin_collection/councils/HerefordshireCouncil.py,sha256=JpQhkWM6Jeuzf1W7r0HqvtVnEqNi18nhwJX70YucdsI,1848
|
145
|
-
uk_bin_collection/uk_bin_collection/councils/HertsmereBoroughCouncil.py,sha256=
|
145
|
+
uk_bin_collection/uk_bin_collection/councils/HertsmereBoroughCouncil.py,sha256=ZbSsmqHStd2JtTMAq1Bhcvsj1BYp6ijELyOjZFX2GSw,6435
|
146
146
|
uk_bin_collection/uk_bin_collection/councils/HighPeakCouncil.py,sha256=x7dfy8mdt2iGl8qJxHb-uBh4u0knmi9MJ6irOJw9WYA,4805
|
147
147
|
uk_bin_collection/uk_bin_collection/councils/HighlandCouncil.py,sha256=GNxDU65QuZHV5va2IrKtcJ6TQoDdwmV03JvkVqOauP4,3291
|
148
148
|
uk_bin_collection/uk_bin_collection/councils/HinckleyandBosworthBoroughCouncil.py,sha256=51vXTKrstfJhb7cLCcrsvA9qKCsptyNMZvy7ML9DasM,2344
|
@@ -156,7 +156,7 @@ uk_bin_collection/uk_bin_collection/councils/KingstonUponThamesCouncil.py,sha256
|
|
156
156
|
uk_bin_collection/uk_bin_collection/councils/KirkleesCouncil.py,sha256=WPM7koIqK5Wz-iT9Mds6AptihGZtl4KZhkVTcT9cx_c,2762
|
157
157
|
uk_bin_collection/uk_bin_collection/councils/KnowsleyMBCouncil.py,sha256=VdlWDESoHfr_X0r8-UMaLMUQhKZOa2BnpVPkX-1u3EQ,5605
|
158
158
|
uk_bin_collection/uk_bin_collection/councils/LancasterCityCouncil.py,sha256=FmHT6oyD4BwWuhxA80PHnGA7HPrLuyjP_54Cg8hT6k4,2537
|
159
|
-
uk_bin_collection/uk_bin_collection/councils/LeedsCityCouncil.py,sha256=
|
159
|
+
uk_bin_collection/uk_bin_collection/councils/LeedsCityCouncil.py,sha256=9dMQrxzGs1VGzzLFQU9NlMvG6Mh_1CMJm_jh8yEdI8I,4355
|
160
160
|
uk_bin_collection/uk_bin_collection/councils/LeicesterCityCouncil.py,sha256=o3kE8sjThQa4_AvSK5NH8VH7jWFO9MMPgoqLOTjyh0w,1851
|
161
161
|
uk_bin_collection/uk_bin_collection/councils/LichfieldDistrictCouncil.py,sha256=l3zgTWuKOW8fgb8PmXv0OTI6HaiGBPndefNQk8MM4oY,1810
|
162
162
|
uk_bin_collection/uk_bin_collection/councils/LincolnCouncil.py,sha256=aUCqjHuk0sLtx83a-2agcLIMgEbfqjltXRCBRXT9J-8,3733
|
@@ -315,7 +315,7 @@ uk_bin_collection/uk_bin_collection/councils/WestSuffolkCouncil.py,sha256=9i8AQH
|
|
315
315
|
uk_bin_collection/uk_bin_collection/councils/WiganBoroughCouncil.py,sha256=3gqFA4-BVx_In6QOu3KUNqPN4Fkn9iMlZTeopMK9p6A,3746
|
316
316
|
uk_bin_collection/uk_bin_collection/councils/WiltshireCouncil.py,sha256=Q0ooHTQb9ynMXpSNBPk7XXEjI7zcHst3id4wxGdmVx4,5698
|
317
317
|
uk_bin_collection/uk_bin_collection/councils/WinchesterCityCouncil.py,sha256=W2k00N5n9-1MzjMEqsNjldsQdOJPEPMjK7OGSinZm5Y,4335
|
318
|
-
uk_bin_collection/uk_bin_collection/councils/WindsorAndMaidenheadCouncil.py,sha256=
|
318
|
+
uk_bin_collection/uk_bin_collection/councils/WindsorAndMaidenheadCouncil.py,sha256=VWtFgypXL1wKQ63NmV-_O9odOkbDmv3uCQwrv8g9lMI,2294
|
319
319
|
uk_bin_collection/uk_bin_collection/councils/WirralCouncil.py,sha256=X_e9zXEZAl_Mp6nPORHc9CTmf3QHdoMY3BCnKrXEr1I,2131
|
320
320
|
uk_bin_collection/uk_bin_collection/councils/WokingBoroughCouncil.py,sha256=37igH9g0xe4XIhRhcJ-ZJBU8MxTp5yzgpadWbdE33Yg,5205
|
321
321
|
uk_bin_collection/uk_bin_collection/councils/WokinghamBoroughCouncil.py,sha256=H8aFHlacwV07X-6T9RQua4irqDA0cIQrF4O1FfPR7yI,4114
|
@@ -328,8 +328,8 @@ uk_bin_collection/uk_bin_collection/councils/YorkCouncil.py,sha256=I2kBYMlsD4bId
|
|
328
328
|
uk_bin_collection/uk_bin_collection/councils/council_class_template/councilclasstemplate.py,sha256=EQWRhZ2pEejlvm0fPyOTsOHKvUZmPnxEYO_OWRGKTjs,1158
|
329
329
|
uk_bin_collection/uk_bin_collection/create_new_council.py,sha256=m-IhmWmeWQlFsTZC4OxuFvtw5ZtB8EAJHxJTH4O59lQ,1536
|
330
330
|
uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=YvmHfZqanwrJ8ToGch34x-L-7yPe31nB_x77_Mgl_vo,4545
|
331
|
-
uk_bin_collection-0.143.
|
332
|
-
uk_bin_collection-0.143.
|
333
|
-
uk_bin_collection-0.143.
|
334
|
-
uk_bin_collection-0.143.
|
335
|
-
uk_bin_collection-0.143.
|
331
|
+
uk_bin_collection-0.143.2.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
|
332
|
+
uk_bin_collection-0.143.2.dist-info/METADATA,sha256=QDsSjYb1sVXm8CGD9xm7nPJwZBTHIxpw6qz1wQpojSw,19851
|
333
|
+
uk_bin_collection-0.143.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
334
|
+
uk_bin_collection-0.143.2.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
|
335
|
+
uk_bin_collection-0.143.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{uk_bin_collection-0.143.1.dist-info → uk_bin_collection-0.143.2.dist-info}/entry_points.txt
RENAMED
File without changes
|