uk_bin_collection 0.135.1__py3-none-any.whl → 0.135.3__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.
@@ -2202,12 +2202,11 @@
2202
2202
  "wiki_note": "Provide your UPRN and postcode. Find your UPRN using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
2203
2203
  },
2204
2204
  "WyreCouncil": {
2205
- "postcode": "FY6 8HG",
2206
2205
  "skip_get_url": true,
2207
2206
  "uprn": "10003519994",
2208
2207
  "url": "https://www.wyre.gov.uk/bins-rubbish-recycling",
2209
2208
  "wiki_name": "Wyre Council",
2210
- "wiki_note": "Provide your UPRN and postcode. Find your UPRN using [FindMyAddress](https://www.findmyaddress.co.uk/search). The postcode should be wrapped in double quotes with a space in the middle."
2209
+ "wiki_note": "Provide your UPRN. Find your UPRN using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
2211
2210
  },
2212
2211
  "WyreForestDistrictCouncil": {
2213
2212
  "house_number": "Monday",
@@ -1,22 +1,19 @@
1
+ from datetime import datetime
2
+
3
+ import requests
1
4
  from bs4 import BeautifulSoup
5
+
2
6
  from uk_bin_collection.uk_bin_collection.common import *
3
7
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
4
8
 
5
9
 
6
10
  class CouncilClass(AbstractGetBinDataClass):
7
- """
8
- Concrete classes have to implement all abstract operations of the
9
- base class. They can also override some operations with a default
10
- implementation.
11
- """
12
-
13
11
  def parse_data(self, page: str, **kwargs) -> dict:
14
12
  uprn = kwargs.get("uprn")
15
13
  check_uprn(uprn)
16
14
 
17
15
  # Figure bin data URL from UPRN
18
16
  url = "https://www.northyorks.gov.uk/bin-calendar/lookup"
19
-
20
17
  payload = {
21
18
  "selected_address": uprn,
22
19
  "submit": "Continue",
@@ -42,17 +39,22 @@ class CouncilClass(AbstractGetBinDataClass):
42
39
  rows = table.find_all("tr")
43
40
 
44
41
  data = {"bins": []}
42
+
45
43
  for row in rows:
46
44
  cols = row.find_all("td")
47
45
  # First column is date
48
46
  bin_date = datetime.strptime(cols[0].text.strip(), "%d %B %Y")
49
- # Third column is type
50
- bin_type = cols[2].text.strip()
51
- # This bin
52
- this_bin = {
53
- "type": bin_type,
54
- "collectionDate": bin_date.strftime(date_format),
55
- }
56
- data["bins"].append(this_bin)
47
+
48
+ # Third column may contain multiple bin types separated by line breaks
49
+ # .stripped_strings yields a generator over all non-whitespace text segments
50
+ bin_types = [txt for txt in cols[2].stripped_strings]
51
+
52
+ for sub_bin in bin_types:
53
+ data["bins"].append(
54
+ {
55
+ "type": sub_bin,
56
+ "collectionDate": bin_date.strftime(date_format),
57
+ }
58
+ )
57
59
 
58
60
  return data
@@ -19,9 +19,6 @@ class CouncilClass(AbstractGetBinDataClass):
19
19
  user_uprn = kwargs.get("uprn")
20
20
  check_uprn(user_uprn)
21
21
 
22
- user_postcode = kwargs.get("postcode")
23
- check_postcode(user_postcode)
24
-
25
22
  data = {"bins": []}
26
23
  collections = []
27
24
 
@@ -41,17 +38,8 @@ class CouncilClass(AbstractGetBinDataClass):
41
38
  "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.186 Safari/537.36",
42
39
  "x-requested-with": "XMLHttpRequest",
43
40
  }
44
- postcode_api = f"https://www.wyre.gov.uk/singlepoint_ajax/{urllib.parse.quote(user_postcode)}"
45
- addr_res = requests.post(postcode_api, headers=headers)
46
- json_data = addr_res.json()
47
-
48
- for v in json_data.values():
49
- v_uprn = v.get("uprn")
50
- if v_uprn == user_uprn:
51
- addr_line = v.get("label")
52
- break
53
41
 
54
- api_url = f"https://www.wyre.gov.uk/bincollections?uprn={user_uprn}&address={urllib.parse.quote(addr_line)}&submit="
42
+ api_url = f"https://www.wyre.gov.uk/bincollections?uprn={user_uprn}"
55
43
  res = requests.get(api_url, headers=headers)
56
44
 
57
45
  soup = BeautifulSoup(res.text, features="html.parser")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uk_bin_collection
3
- Version: 0.135.1
3
+ Version: 0.135.3
4
4
  Summary: Python Lib to collect UK Bin Data
5
5
  Author: Robert Bradley
6
6
  Author-email: robbrad182@gmail.com
@@ -3,7 +3,7 @@ uk_bin_collection/tests/check_selenium_url_in_input.json.py,sha256=Iecdja0I3XIiY
3
3
  uk_bin_collection/tests/council_feature_input_parity.py,sha256=DO6Mk4ImYgM5ZCZ-cutwz5RoYYWZRLYx2tr6zIs_9Rc,3843
4
4
  uk_bin_collection/tests/features/environment.py,sha256=VQZjJdJI_kZn08M0j5cUgvKT4k3iTw8icJge1DGOkoA,127
5
5
  uk_bin_collection/tests/features/validate_council_outputs.feature,sha256=SJK-Vc737hrf03tssxxbeg_JIvAH-ddB8f6gU1LTbuQ,251
6
- uk_bin_collection/tests/input.json,sha256=YgUI7DkX6n4vwsFvYEmHwkS3yn6Td5QZWFAva8Bj5PY,116367
6
+ uk_bin_collection/tests/input.json,sha256=1WxEeiVgfEgwPt9QE7-fHgW3itmi4SiMJ6DzzXnmq5U,116247
7
7
  uk_bin_collection/tests/output.schema,sha256=ZwKQBwYyTDEM4G2hJwfLUVM-5v1vKRvRK9W9SS1sd18,1086
8
8
  uk_bin_collection/tests/step_defs/step_helpers/file_handler.py,sha256=Ygzi4V0S1MIHqbdstUlIqtRIwnynvhu4UtpweJ6-5N8,1474
9
9
  uk_bin_collection/tests/step_defs/test_validate_council.py,sha256=VZ0a81sioJULD7syAYHjvK_-nT_Rd36tUyzPetSA0gk,3475
@@ -200,7 +200,7 @@ uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py,sha
200
200
  uk_bin_collection/uk_bin_collection/councils/NorthSomersetCouncil.py,sha256=EbFVnPYZIOkru5_Y75kjljM3Cr3HIJgP-SU6hxgf6tk,2754
201
201
  uk_bin_collection/uk_bin_collection/councils/NorthTynesideCouncil.py,sha256=MHfcSrfWBIiWwVnhOqUrOkr0Ahguu_oU4pHrv_vSa-Y,5929
202
202
  uk_bin_collection/uk_bin_collection/councils/NorthWestLeicestershire.py,sha256=gJj0dyQc5QUefqusKGk2LLXfWbG5tlEXUOh8KAPh3RI,4584
203
- uk_bin_collection/uk_bin_collection/councils/NorthYorkshire.py,sha256=2wTrr3VrZDp9-YtDPmWd649gXeWH4hbm2-Hw8Vau5Xs,1933
203
+ uk_bin_collection/uk_bin_collection/councils/NorthYorkshire.py,sha256=rwW6y5yhRiuYk3lVS7YFZxLaY_yfojdcn2dxiWaP4YA,2013
204
204
  uk_bin_collection/uk_bin_collection/councils/NorthumberlandCouncil.py,sha256=CF9__v8xOUJ9Ukic9Yg9WnVUojV3Cv6_dHAHJzL6V3o,5106
205
205
  uk_bin_collection/uk_bin_collection/councils/NorwichCityCouncil.py,sha256=6w5-xKiyxTlJLaCkwUnAWjd5jnohonnNRr0sTlfACvk,2702
206
206
  uk_bin_collection/uk_bin_collection/councils/NottinghamCityCouncil.py,sha256=panTCjnsBOQ98-TBO9xVZk_jcT_gjMhx3Gg5oWxBRLo,1254
@@ -309,14 +309,14 @@ uk_bin_collection/uk_bin_collection/councils/WokinghamBoroughCouncil.py,sha256=H
309
309
  uk_bin_collection/uk_bin_collection/councils/WolverhamptonCityCouncil.py,sha256=ncXfu5RHPCFsArczXHy7g0l_HEZa7GC-QA1QRReP_00,1801
310
310
  uk_bin_collection/uk_bin_collection/councils/WorcesterCityCouncil.py,sha256=dKHB2fPSmOGOwyvfpbdR4U8XW2ctBf63gCPxX06kwKA,1867
311
311
  uk_bin_collection/uk_bin_collection/councils/WychavonDistrictCouncil.py,sha256=GnNNMe33YMlK6S7rjM3c4BQkBnXelS0DKl2x5V4fb2w,5775
312
- uk_bin_collection/uk_bin_collection/councils/WyreCouncil.py,sha256=zDDa7n4K_zm5PgDL08A26gD9yOOsOhuexI3x2seaBF4,3511
312
+ uk_bin_collection/uk_bin_collection/councils/WyreCouncil.py,sha256=QpCkmRSQmJo0RLsjXoCYPDcoxuDzG_00qNV0AHTDmXo,3000
313
313
  uk_bin_collection/uk_bin_collection/councils/WyreForestDistrictCouncil.py,sha256=3b7WzBXdYub6j13sqDL3jlqgICKmNyQaF4KxRxOMHWk,2000
314
314
  uk_bin_collection/uk_bin_collection/councils/YorkCouncil.py,sha256=I2kBYMlsD4bIdsvmoSzBjJAvTTi6yPfJa8xjJx1ys2w,1490
315
315
  uk_bin_collection/uk_bin_collection/councils/council_class_template/councilclasstemplate.py,sha256=EQWRhZ2pEejlvm0fPyOTsOHKvUZmPnxEYO_OWRGKTjs,1158
316
316
  uk_bin_collection/uk_bin_collection/create_new_council.py,sha256=m-IhmWmeWQlFsTZC4OxuFvtw5ZtB8EAJHxJTH4O59lQ,1536
317
317
  uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=YvmHfZqanwrJ8ToGch34x-L-7yPe31nB_x77_Mgl_vo,4545
318
- uk_bin_collection-0.135.1.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
319
- uk_bin_collection-0.135.1.dist-info/METADATA,sha256=qeUmV9kdAQjWn7zNc6f6aWfwb1OXI33ZJkv0QVYuykU,19741
320
- uk_bin_collection-0.135.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
321
- uk_bin_collection-0.135.1.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
322
- uk_bin_collection-0.135.1.dist-info/RECORD,,
318
+ uk_bin_collection-0.135.3.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
319
+ uk_bin_collection-0.135.3.dist-info/METADATA,sha256=hmaNZDf9gPgRkIP7dLin2bsLgIGoGEej5w-VieP-53Q,19741
320
+ uk_bin_collection-0.135.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
321
+ uk_bin_collection-0.135.3.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
322
+ uk_bin_collection-0.135.3.dist-info/RECORD,,