uk_bin_collection 0.75.0__py3-none-any.whl → 0.76.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/tests/council_feature_input_parity.py +13 -1
- uk_bin_collection/uk_bin_collection/councils/BarnetCouncil.py +15 -0
- uk_bin_collection/uk_bin_collection/councils/WestSuffolkCouncil.py +31 -18
- {uk_bin_collection-0.75.0.dist-info → uk_bin_collection-0.76.1.dist-info}/METADATA +1 -1
- {uk_bin_collection-0.75.0.dist-info → uk_bin_collection-0.76.1.dist-info}/RECORD +8 -8
- {uk_bin_collection-0.75.0.dist-info → uk_bin_collection-0.76.1.dist-info}/LICENSE +0 -0
- {uk_bin_collection-0.75.0.dist-info → uk_bin_collection-0.76.1.dist-info}/WHEEL +0 -0
- {uk_bin_collection-0.75.0.dist-info → uk_bin_collection-0.76.1.dist-info}/entry_points.txt +0 -0
@@ -8,7 +8,19 @@ def get_councils_from_files(branch):
|
|
8
8
|
url = f"https://api.github.com/repos/robbrad/UKBinCollectionData/contents/uk_bin_collection/uk_bin_collection/councils?ref={branch}"
|
9
9
|
response = requests.get(url)
|
10
10
|
data = response.json()
|
11
|
-
|
11
|
+
|
12
|
+
# Debugging lines to check the response content and type
|
13
|
+
print(f"Response Status Code: {response.status_code}")
|
14
|
+
print(f"Response Content: {response.content}")
|
15
|
+
print(f"Parsed JSON Data: {data}")
|
16
|
+
print(f"Data Type: {type(data)}")
|
17
|
+
|
18
|
+
# Ensure 'data' is a list before proceeding
|
19
|
+
if isinstance(data, list):
|
20
|
+
return [item['name'].replace('.py', '') for item in data if item['name'].endswith('.py')]
|
21
|
+
else:
|
22
|
+
raise ValueError("Expected a list from the JSON response but got something else.")
|
23
|
+
|
12
24
|
|
13
25
|
def get_councils_from_json(branch):
|
14
26
|
url = f"https://raw.githubusercontent.com/robbrad/UKBinCollectionData/{branch}/uk_bin_collection/tests/input.json"
|
@@ -75,6 +75,21 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
75
75
|
|
76
76
|
time.sleep(5)
|
77
77
|
|
78
|
+
try:
|
79
|
+
accept_cookies = WebDriverWait(driver, timeout=10).until(
|
80
|
+
EC.presence_of_element_located((By.ID, "epdagree"))
|
81
|
+
)
|
82
|
+
accept_cookies.click()
|
83
|
+
accept_cookies_submit = WebDriverWait(driver, timeout=10).until(
|
84
|
+
EC.presence_of_element_located((By.ID, "epdsubmit"))
|
85
|
+
)
|
86
|
+
accept_cookies_submit.click()
|
87
|
+
except:
|
88
|
+
print(
|
89
|
+
"Accept cookies banner not found or clickable within the specified time."
|
90
|
+
)
|
91
|
+
pass
|
92
|
+
|
78
93
|
postcode_input = WebDriverWait(driver, 10).until(
|
79
94
|
EC.presence_of_element_located(
|
80
95
|
(By.CSS_SELECTOR, '[aria-label="Postcode"]')
|
@@ -13,9 +13,7 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
13
13
|
data = {"bins": []}
|
14
14
|
user_uprn = kwargs.get("uprn")
|
15
15
|
|
16
|
-
api_url =
|
17
|
-
f"https://maps.westsuffolk.gov.uk/MyWestSuffolk.aspx?action=SetAddress&UniqueId={user_uprn}"
|
18
|
-
)
|
16
|
+
api_url = f"https://maps.westsuffolk.gov.uk/MyWestSuffolk.aspx?action=SetAddress&UniqueId={user_uprn}"
|
19
17
|
|
20
18
|
response = requests.get(api_url)
|
21
19
|
|
@@ -33,7 +31,9 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
33
31
|
if tag_class is None:
|
34
32
|
return False
|
35
33
|
|
36
|
-
parent_has_header = cur_tag.parent.find_all(
|
34
|
+
parent_has_header = cur_tag.parent.find_all(
|
35
|
+
"h4", string="Bin collection days"
|
36
|
+
)
|
37
37
|
if len(parent_has_header) < 1:
|
38
38
|
return False
|
39
39
|
|
@@ -46,19 +46,32 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
46
46
|
text_list = list(tag.stripped_strings)
|
47
47
|
# Create and parse the list as tuples of name:date
|
48
48
|
for bin_name, collection_date in itertools.batched(text_list, 2):
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
49
|
+
try:
|
50
|
+
# Clean-up the bin_name
|
51
|
+
bin_name_clean = (
|
52
|
+
bin_name.strip()
|
53
|
+
.replace("\r", "")
|
54
|
+
.replace("\n", "")
|
55
|
+
.replace(":", "")
|
56
|
+
)
|
57
|
+
bin_name_clean = re.sub(" +", " ", bin_name_clean)
|
58
|
+
|
59
|
+
# Get the bin colour
|
60
|
+
bin_colour = "".join(re.findall(r"^(.*) ", bin_name_clean))
|
61
|
+
|
62
|
+
# Parse the date
|
63
|
+
next_collection = date_parse(collection_date)
|
64
|
+
next_collection = next_collection.replace(year=datetime.now().year)
|
65
|
+
|
66
|
+
dict_data = {
|
67
|
+
"type": bin_name_clean,
|
68
|
+
"colour": bin_colour,
|
69
|
+
"collectionDate": next_collection.strftime(date_format),
|
70
|
+
}
|
71
|
+
|
72
|
+
data["bins"].append(dict_data)
|
73
|
+
|
74
|
+
except Exception as ex:
|
75
|
+
raise ValueError(f"Error parsing bin data: {ex}")
|
63
76
|
|
64
77
|
return data
|
@@ -1,5 +1,5 @@
|
|
1
1
|
uk_bin_collection/README.rst,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
uk_bin_collection/tests/council_feature_input_parity.py,sha256=
|
2
|
+
uk_bin_collection/tests/council_feature_input_parity.py,sha256=66MrXc-3SnkricUV7LyAs9GFux7wEH31xcs9xbdB5Qo,3515
|
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=XIYnckDPBwBd7jTX2CN7Nv4mhUQsiJYOnYzvXVGfpdk,16246
|
5
5
|
uk_bin_collection/tests/input.json,sha256=lbJZCvGd0kvIvI-0dD7Q9clMnkk_zX2UWbp8j2Ji1ow,53474
|
@@ -14,7 +14,7 @@ uk_bin_collection/uk_bin_collection/councils/AdurAndWorthingCouncils.py,sha256=p
|
|
14
14
|
uk_bin_collection/uk_bin_collection/councils/ArunCouncil.py,sha256=yfhthv9nuogP19VOZ3TYQrq51qqjiCZcSel4sXhiKjs,4012
|
15
15
|
uk_bin_collection/uk_bin_collection/councils/AylesburyValeCouncil.py,sha256=LouqjspEMt1TkOGqWHs2zkxwOETIy3n7p64uKIlAgUg,2401
|
16
16
|
uk_bin_collection/uk_bin_collection/councils/BCPCouncil.py,sha256=W7QBx6Mgso8RYosuXsaYo3GGNAu-tiyBSmuYxr1JSOU,1707
|
17
|
-
uk_bin_collection/uk_bin_collection/councils/BarnetCouncil.py,sha256=
|
17
|
+
uk_bin_collection/uk_bin_collection/councils/BarnetCouncil.py,sha256=n6lNsO_ognmaxq_wIz91Dxt5XjBVQe60X5p6w1_mO1A,8174
|
18
18
|
uk_bin_collection/uk_bin_collection/councils/BarnsleyMBCouncil.py,sha256=MgF_7XyIcIoNzFR0OJsjBkLCZKgWxBrV6nTcutMxO1Q,4244
|
19
19
|
uk_bin_collection/uk_bin_collection/councils/BasingstokeCouncil.py,sha256=VPWGljnH4C3q8qs5ZmCtqjNjgWQvviALzjk00q3EZeQ,2632
|
20
20
|
uk_bin_collection/uk_bin_collection/councils/BathAndNorthEastSomersetCouncil.py,sha256=N_TPiIv8VBzN3rY0p3JtLlxSEru-6k1wW4UNIhN5X1M,3709
|
@@ -155,7 +155,7 @@ uk_bin_collection/uk_bin_collection/councils/WestBerkshireCouncil.py,sha256=r90A
|
|
155
155
|
uk_bin_collection/uk_bin_collection/councils/WestLindseyDistrictCouncil.py,sha256=JFWUy4w0CKulGq16PfbRDKAdQEbokVEuabwlZYigdEU,4606
|
156
156
|
uk_bin_collection/uk_bin_collection/councils/WestLothianCouncil.py,sha256=dq0jimtARvRkZiGbVFrXXZgY-BODtz3uYZ5UKn0bf64,4114
|
157
157
|
uk_bin_collection/uk_bin_collection/councils/WestNorthamptonshireCouncil.py,sha256=F1GeJUGND4DN_HuM6N0Elpeb0DAMm9_KeqG6qtIgZf4,1079
|
158
|
-
uk_bin_collection/uk_bin_collection/councils/WestSuffolkCouncil.py,sha256=
|
158
|
+
uk_bin_collection/uk_bin_collection/councils/WestSuffolkCouncil.py,sha256=HMFWxM7VMhBuC7iubNGbZYEoCVWi--gRHDJMVdPPFOM,2633
|
159
159
|
uk_bin_collection/uk_bin_collection/councils/WiganBoroughCouncil.py,sha256=YEbpbjkparhah4ahl6WZzI0mMHNrbKzdC6kA5gDQCUA,3745
|
160
160
|
uk_bin_collection/uk_bin_collection/councils/WiltshireCouncil.py,sha256=it2Oh5Kmq3lD30gAZgk2bzZPNCtJcFHyQO1NgOQtfvU,5653
|
161
161
|
uk_bin_collection/uk_bin_collection/councils/WindsorAndMaidenheadCouncil.py,sha256=triYeI4IIHF6_XMokF6BGAZkx_lPAXeGyuS9DEr5UxY,5553
|
@@ -164,8 +164,8 @@ uk_bin_collection/uk_bin_collection/councils/WyreCouncil.py,sha256=zDDa7n4K_zm5P
|
|
164
164
|
uk_bin_collection/uk_bin_collection/councils/YorkCouncil.py,sha256=I2kBYMlsD4bIdsvmoSzBjJAvTTi6yPfJa8xjJx1ys2w,1490
|
165
165
|
uk_bin_collection/uk_bin_collection/councils/council_class_template/councilclasstemplate.py,sha256=4s9ODGPAwPqwXc8SrTX5Wlfmizs3_58iXUtHc4Ir86o,1162
|
166
166
|
uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=9qppF2oPkhmOoK8-ZkRIU1M6vhBh-yUCWAZEEd07iLk,5414
|
167
|
-
uk_bin_collection-0.
|
168
|
-
uk_bin_collection-0.
|
169
|
-
uk_bin_collection-0.
|
170
|
-
uk_bin_collection-0.
|
171
|
-
uk_bin_collection-0.
|
167
|
+
uk_bin_collection-0.76.1.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
|
168
|
+
uk_bin_collection-0.76.1.dist-info/METADATA,sha256=hxUuy3JDHnEOpdpGmTvly1ME2eNlTxOBM5n9ln6EmEg,12594
|
169
|
+
uk_bin_collection-0.76.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
170
|
+
uk_bin_collection-0.76.1.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
|
171
|
+
uk_bin_collection-0.76.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|