uk_bin_collection 0.74.1__py3-none-any.whl → 0.76.0__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.
Files changed (53) hide show
  1. uk_bin_collection/tests/council_feature_input_parity.py +13 -1
  2. uk_bin_collection/tests/test_common_functions.py +1 -1
  3. uk_bin_collection/uk_bin_collection/common.py +4 -1
  4. uk_bin_collection/uk_bin_collection/councils/ArunCouncil.py +6 -5
  5. uk_bin_collection/uk_bin_collection/councils/BarnetCouncil.py +2 -3
  6. uk_bin_collection/uk_bin_collection/councils/BexleyCouncil.py +5 -5
  7. uk_bin_collection/uk_bin_collection/councils/BlackburnCouncil.py +7 -5
  8. uk_bin_collection/uk_bin_collection/councils/BoltonCouncil.py +5 -4
  9. uk_bin_collection/uk_bin_collection/councils/BrightonandHoveCityCouncil.py +10 -10
  10. uk_bin_collection/uk_bin_collection/councils/BromleyBoroughCouncil.py +6 -6
  11. uk_bin_collection/uk_bin_collection/councils/BroxtoweBoroughCouncil.py +1 -1
  12. uk_bin_collection/uk_bin_collection/councils/BuckinghamshireCouncil.py +3 -2
  13. uk_bin_collection/uk_bin_collection/councils/CalderdaleCouncil.py +9 -10
  14. uk_bin_collection/uk_bin_collection/councils/ChelmsfordCityCouncil.py +10 -10
  15. uk_bin_collection/uk_bin_collection/councils/CheshireWestAndChesterCouncil.py +35 -11
  16. uk_bin_collection/uk_bin_collection/councils/ChorleyCouncil.py +2 -1
  17. uk_bin_collection/uk_bin_collection/councils/DerbyshireDalesDistrictCouncil.py +1 -1
  18. uk_bin_collection/uk_bin_collection/councils/EastLindseyDistrictCouncil.py +1 -1
  19. uk_bin_collection/uk_bin_collection/councils/EastRidingCouncil.py +6 -7
  20. uk_bin_collection/uk_bin_collection/councils/EastSuffolkCouncil.py +3 -2
  21. uk_bin_collection/uk_bin_collection/councils/ForestOfDeanDistrictCouncil.py +5 -5
  22. uk_bin_collection/uk_bin_collection/councils/GatesheadCouncil.py +1 -1
  23. uk_bin_collection/uk_bin_collection/councils/GuildfordCouncil.py +10 -10
  24. uk_bin_collection/uk_bin_collection/councils/HaltonBoroughCouncil.py +5 -4
  25. uk_bin_collection/uk_bin_collection/councils/HighPeakCouncil.py +1 -1
  26. uk_bin_collection/uk_bin_collection/councils/KingstonUponThamesCouncil.py +6 -4
  27. uk_bin_collection/uk_bin_collection/councils/KirkleesCouncil.py +1 -1
  28. uk_bin_collection/uk_bin_collection/councils/KnowsleyMBCouncil.py +4 -3
  29. uk_bin_collection/uk_bin_collection/councils/LeedsCityCouncil.py +6 -7
  30. uk_bin_collection/uk_bin_collection/councils/LondonBoroughRedbridge.py +10 -10
  31. uk_bin_collection/uk_bin_collection/councils/MidAndEastAntrimBoroughCouncil.py +4 -3
  32. uk_bin_collection/uk_bin_collection/councils/NeathPortTalbotCouncil.py +2 -1
  33. uk_bin_collection/uk_bin_collection/councils/NorthEastDerbyshireDistrictCouncil.py +3 -3
  34. uk_bin_collection/uk_bin_collection/councils/NorthNorfolkDistrictCouncil.py +1 -1
  35. uk_bin_collection/uk_bin_collection/councils/NorthWestLeicestershire.py +4 -4
  36. uk_bin_collection/uk_bin_collection/councils/NorthumberlandCouncil.py +2 -2
  37. uk_bin_collection/uk_bin_collection/councils/PortsmouthCityCouncil.py +4 -4
  38. uk_bin_collection/uk_bin_collection/councils/PrestonCityCouncil.py +4 -4
  39. uk_bin_collection/uk_bin_collection/councils/ReigateAndBansteadBoroughCouncil.py +1 -1
  40. uk_bin_collection/uk_bin_collection/councils/RenfrewshireCouncil.py +1 -1
  41. uk_bin_collection/uk_bin_collection/councils/RushcliffeBoroughCouncil.py +1 -1
  42. uk_bin_collection/uk_bin_collection/councils/SevenoaksDistrictCouncil.py +4 -4
  43. uk_bin_collection/uk_bin_collection/councils/StaffordshireMoorlandsDistrictCouncil.py +1 -1
  44. uk_bin_collection/uk_bin_collection/councils/SunderlandCityCouncil.py +4 -4
  45. uk_bin_collection/uk_bin_collection/councils/WakefieldCityCouncil.py +1 -1
  46. uk_bin_collection/uk_bin_collection/councils/WestBerkshireCouncil.py +1 -4
  47. uk_bin_collection/uk_bin_collection/councils/WestLothianCouncil.py +1 -1
  48. uk_bin_collection/uk_bin_collection/councils/WestSuffolkCouncil.py +31 -18
  49. {uk_bin_collection-0.74.1.dist-info → uk_bin_collection-0.76.0.dist-info}/METADATA +1 -1
  50. {uk_bin_collection-0.74.1.dist-info → uk_bin_collection-0.76.0.dist-info}/RECORD +53 -53
  51. {uk_bin_collection-0.74.1.dist-info → uk_bin_collection-0.76.0.dist-info}/LICENSE +0 -0
  52. {uk_bin_collection-0.74.1.dist-info → uk_bin_collection-0.76.0.dist-info}/WHEEL +0 -0
  53. {uk_bin_collection-0.74.1.dist-info → uk_bin_collection-0.76.0.dist-info}/entry_points.txt +0 -0
@@ -1,15 +1,16 @@
1
- from bs4 import BeautifulSoup
1
+ import time
2
2
  from datetime import datetime
3
+
4
+ from bs4 import BeautifulSoup
3
5
  from selenium.webdriver.common.by import By
4
6
  from selenium.webdriver.common.keys import Keys
5
7
  from selenium.webdriver.support import expected_conditions as EC
6
8
  from selenium.webdriver.support.ui import Select
7
9
  from selenium.webdriver.support.wait import WebDriverWait
8
- import time
10
+
9
11
  from uk_bin_collection.uk_bin_collection.common import *
10
12
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
11
13
 
12
-
13
14
  # import the wonderful Beautiful Soup and the URL grabber
14
15
 
15
16
 
@@ -34,7 +35,7 @@ class CouncilClass(AbstractGetBinDataClass):
34
35
  f"https://webapp.halton.gov.uk/PublicWebForms/WasteServiceSearchv1.aspx"
35
36
  )
36
37
 
37
- driver = create_webdriver(web_driver, headless)
38
+ driver = create_webdriver(web_driver, headless, None, __name__)
38
39
  driver.get(page)
39
40
 
40
41
  # If you bang in the house number (or property name) and postcode in the box it should find your property
@@ -66,7 +66,7 @@ class CouncilClass(AbstractGetBinDataClass):
66
66
  headless = kwargs.get("headless")
67
67
 
68
68
  # Create Selenium webdriver
69
- driver = create_webdriver(web_driver, headless)
69
+ driver = create_webdriver(web_driver, headless, None, __name__)
70
70
  driver.get(page)
71
71
 
72
72
  # Hide Cookies
@@ -4,14 +4,16 @@
4
4
 
5
5
  # switched to using Selenium as the htmx elements are not rendered reliably with requests
6
6
 
7
+ import re
8
+
9
+ from bs4 import BeautifulSoup
7
10
  from selenium import webdriver
8
11
  from selenium.webdriver.common.by import By
9
- from selenium.webdriver.support.ui import WebDriverWait
10
12
  from selenium.webdriver.support import expected_conditions as EC
11
- from bs4 import BeautifulSoup
13
+ from selenium.webdriver.support.ui import WebDriverWait
14
+
12
15
  from uk_bin_collection.uk_bin_collection.common import *
13
16
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
14
- import re
15
17
 
16
18
 
17
19
  # import the wonderful Beautiful Soup and the URL grabber
@@ -29,7 +31,7 @@ class CouncilClass(AbstractGetBinDataClass):
29
31
 
30
32
  headless = kwargs.get("headless")
31
33
  web_driver = kwargs.get("web_driver")
32
- driver = create_webdriver(web_driver, headless)
34
+ driver = create_webdriver(web_driver, headless, None, __name__)
33
35
  driver.get(kwargs.get("url"))
34
36
  wait = WebDriverWait(driver, 15, 2)
35
37
 
@@ -61,7 +61,7 @@ class CouncilClass(AbstractGetBinDataClass):
61
61
  user_postcode = kwargs["postcode"]
62
62
 
63
63
  self._driver = driver = create_webdriver(
64
- web_driver=kwargs["web_driver"], headless=kwargs.get("headless", True)
64
+ web_driver=kwargs["web_driver"], headless=kwargs.get("headless", True), session_name=__name__
65
65
  )
66
66
  driver.implicitly_wait(1)
67
67
 
@@ -1,13 +1,14 @@
1
1
  import time
2
2
 
3
3
  from bs4 import BeautifulSoup
4
- from uk_bin_collection.uk_bin_collection.common import *
5
- from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
6
4
  from selenium.webdriver.common.by import By
7
5
  from selenium.webdriver.support import expected_conditions as EC
8
6
  from selenium.webdriver.support.ui import Select
9
7
  from selenium.webdriver.support.wait import WebDriverWait
10
8
 
9
+ from uk_bin_collection.uk_bin_collection.common import *
10
+ from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
11
+
11
12
 
12
13
  # import the wonderful Beautiful Soup and the URL grabber
13
14
  class CouncilClass(AbstractGetBinDataClass):
@@ -30,7 +31,7 @@ class CouncilClass(AbstractGetBinDataClass):
30
31
  check_postcode(user_postcode)
31
32
 
32
33
  # Create Selenium webdriver
33
- driver = create_webdriver(web_driver, headless)
34
+ driver = create_webdriver(web_driver, headless, None, __name__)
34
35
  driver.get(
35
36
  "https://knowsleytransaction.mendixcloud.com/link/youarebeingredirected?target=bincollectioninformation"
36
37
  )
@@ -1,17 +1,16 @@
1
+ import urllib.request
1
2
  from datetime import datetime
2
- from uk_bin_collection.uk_bin_collection.common import *
3
- from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
4
3
 
4
+ import pandas as pd
5
5
  from bs4 import BeautifulSoup
6
- from datetime import datetime
7
6
  from selenium.webdriver.common.by import By
7
+ from selenium.webdriver.common.keys import Keys
8
8
  from selenium.webdriver.support import expected_conditions as EC
9
9
  from selenium.webdriver.support.ui import Select
10
10
  from selenium.webdriver.support.wait import WebDriverWait
11
- from selenium.webdriver.common.keys import Keys
12
11
 
13
- import pandas as pd
14
- import urllib.request
12
+ from uk_bin_collection.uk_bin_collection.common import *
13
+ from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
15
14
 
16
15
 
17
16
  class CouncilClass(AbstractGetBinDataClass):
@@ -37,7 +36,7 @@ class CouncilClass(AbstractGetBinDataClass):
37
36
  # Create Selenium webdriver
38
37
  page = f"https://www.leeds.gov.uk/residents/bins-and-recycling/check-your-bin-day"
39
38
 
40
- driver = create_webdriver(web_driver, headless)
39
+ driver = create_webdriver(web_driver, headless, None, __name__)
41
40
  driver.get(page)
42
41
 
43
42
  wait = WebDriverWait(driver, 60)
@@ -1,19 +1,19 @@
1
- import re
2
- import requests
3
- from bs4 import BeautifulSoup
4
-
5
- from uk_bin_collection.uk_bin_collection.common import *
6
- from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
7
-
8
1
  # This script pulls (in one hit) the data from Bromley Council Bins Data
9
2
  import datetime
3
+ import re
4
+ import time
10
5
  from datetime import datetime
6
+
7
+ import requests
8
+ from bs4 import BeautifulSoup
11
9
  from selenium.webdriver.common.by import By
10
+ from selenium.webdriver.common.keys import Keys
12
11
  from selenium.webdriver.support import expected_conditions as EC
13
12
  from selenium.webdriver.support.ui import Select
14
13
  from selenium.webdriver.support.wait import WebDriverWait
15
- from selenium.webdriver.common.keys import Keys
16
- import time
14
+
15
+ from uk_bin_collection.uk_bin_collection.common import *
16
+ from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
17
17
 
18
18
 
19
19
  # import the wonderful Beautiful Soup and the URL grabber
@@ -34,7 +34,7 @@ class CouncilClass(AbstractGetBinDataClass):
34
34
  postcode = kwargs.get("postcode")
35
35
  web_driver = kwargs.get("web_driver")
36
36
  headless = kwargs.get("headless")
37
- driver = create_webdriver(web_driver, headless)
37
+ driver = create_webdriver(web_driver, headless, None, __name__)
38
38
  driver.get(kwargs.get("url"))
39
39
 
40
40
  wait = WebDriverWait(driver, 60)
@@ -1,10 +1,11 @@
1
- from bs4 import BeautifulSoup
2
1
  import time
2
+
3
+ from bs4 import BeautifulSoup
3
4
  from dateutil.relativedelta import relativedelta
5
+ from selenium.common.exceptions import NoSuchElementException
4
6
  from selenium.webdriver.common.by import By
5
7
  from selenium.webdriver.common.keys import Keys
6
8
  from selenium.webdriver.support.ui import Select
7
- from selenium.common.exceptions import NoSuchElementException
8
9
 
9
10
  from uk_bin_collection.uk_bin_collection.common import *
10
11
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
@@ -31,7 +32,7 @@ class CouncilClass(AbstractGetBinDataClass):
31
32
  # Create Selenium webdriver
32
33
  options = webdriver.ChromeOptions()
33
34
  options.add_experimental_option("excludeSwitches", ["enable-logging"])
34
- driver = create_webdriver(web_driver, headless)
35
+ driver = create_webdriver(web_driver, headless, None, __name__)
35
36
 
36
37
  driver.get(page)
37
38
 
@@ -1,4 +1,5 @@
1
1
  import time
2
+
2
3
  from bs4 import BeautifulSoup
3
4
  from selenium.webdriver.common.by import By
4
5
  from selenium.webdriver.support import expected_conditions as EC
@@ -29,7 +30,7 @@ class CouncilClass(AbstractGetBinDataClass):
29
30
  check_postcode(user_postcode)
30
31
 
31
32
  # Create Selenium webdriver
32
- driver = create_webdriver(web_driver, headless)
33
+ driver = create_webdriver(web_driver, headless, None, __name__)
33
34
  driver.get("https://www.npt.gov.uk/2195")
34
35
 
35
36
  # Accept cookies banner
@@ -1,5 +1,6 @@
1
- from bs4 import BeautifulSoup
2
1
  from datetime import datetime
2
+
3
+ from bs4 import BeautifulSoup
3
4
  from selenium.webdriver.common.by import By
4
5
  from selenium.webdriver.support import expected_conditions as EC
5
6
  from selenium.webdriver.support.ui import Select
@@ -8,7 +9,6 @@ from selenium.webdriver.support.wait import WebDriverWait
8
9
  from uk_bin_collection.uk_bin_collection.common import *
9
10
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
10
11
 
11
-
12
12
  # import the wonderful Beautiful Soup and the URL grabber
13
13
 
14
14
 
@@ -35,7 +35,7 @@ class CouncilClass(AbstractGetBinDataClass):
35
35
  check_uprn(user_uprn)
36
36
  check_postcode(user_postcode)
37
37
  # Create Selenium webdriver
38
- driver = create_webdriver(web_driver, headless)
38
+ driver = create_webdriver(web_driver, headless, None, __name__)
39
39
  driver.get(page)
40
40
 
41
41
  # If you bang in the house number (or property name) and postcode in the box it should find your property
@@ -31,7 +31,7 @@ class CouncilClass(AbstractGetBinDataClass):
31
31
  check_postcode(user_postcode)
32
32
 
33
33
  # Create Selenium webdriver
34
- driver = create_webdriver(web_driver, headless)
34
+ driver = create_webdriver(web_driver, headless, None, __name__)
35
35
  driver.get(page)
36
36
 
37
37
  # Populate postcode field
@@ -1,15 +1,15 @@
1
- from bs4 import BeautifulSoup
1
+ import re # Import regular expressions
2
2
  from datetime import datetime, timedelta
3
+
4
+ from bs4 import BeautifulSoup
3
5
  from selenium.webdriver.common.by import By
4
6
  from selenium.webdriver.support import expected_conditions as EC
5
7
  from selenium.webdriver.support.ui import Select
6
8
  from selenium.webdriver.support.wait import WebDriverWait
7
- import re # Import regular expressions
8
9
 
9
10
  from uk_bin_collection.uk_bin_collection.common import *
10
11
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
11
12
 
12
-
13
13
  # import the wonderful Beautiful Soup and the URL grabber
14
14
 
15
15
 
@@ -34,7 +34,7 @@ class CouncilClass(AbstractGetBinDataClass):
34
34
  # Create Selenium webdriver
35
35
  page = f"https://my.nwleics.gov.uk/my-property-finder?address={user_postcode}&go=1"
36
36
 
37
- driver = create_webdriver(web_driver, headless)
37
+ driver = create_webdriver(web_driver, headless, None, __name__)
38
38
  driver.get(page)
39
39
 
40
40
  # If you bang in the house number (or property name) and postcode in the box it should find your property
@@ -1,11 +1,11 @@
1
1
  import time
2
+
2
3
  from bs4 import BeautifulSoup
3
4
  from selenium.webdriver.common.by import By
4
5
 
5
6
  from uk_bin_collection.uk_bin_collection.common import *
6
7
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
7
8
 
8
-
9
9
  # import the wonderful Beautiful Soup and the URL grabber
10
10
 
11
11
 
@@ -39,7 +39,7 @@ class CouncilClass(AbstractGetBinDataClass):
39
39
  check_postcode(user_postcode)
40
40
 
41
41
  # Create Selenium webdriver
42
- driver = create_webdriver(web_driver, headless)
42
+ driver = create_webdriver(web_driver, headless, None, __name__)
43
43
  driver.get(page)
44
44
 
45
45
  time.sleep(1)
@@ -1,15 +1,15 @@
1
- from bs4 import BeautifulSoup
1
+ import time
2
2
  from datetime import datetime
3
+
4
+ from bs4 import BeautifulSoup
3
5
  from selenium.webdriver.common.by import By
4
6
  from selenium.webdriver.support import expected_conditions as EC
5
7
  from selenium.webdriver.support.ui import Select
6
8
  from selenium.webdriver.support.wait import WebDriverWait
7
9
 
8
- import time
9
10
  from uk_bin_collection.uk_bin_collection.common import *
10
11
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
11
12
 
12
-
13
13
  # import the wonderful Beautiful Soup and the URL grabber
14
14
 
15
15
 
@@ -34,7 +34,7 @@ class CouncilClass(AbstractGetBinDataClass):
34
34
  check_uprn(user_uprn)
35
35
  check_postcode(user_postcode)
36
36
  # Create Selenium webdriver
37
- driver = create_webdriver(web_driver, headless)
37
+ driver = create_webdriver(web_driver, headless, None, __name__)
38
38
  driver.get(page)
39
39
 
40
40
  # If you bang in the house number (or property name) and postcode in the box it should find your property
@@ -1,14 +1,14 @@
1
- from bs4 import BeautifulSoup
2
1
  from datetime import datetime
2
+
3
+ from bs4 import BeautifulSoup
3
4
  from selenium.webdriver.common.by import By
5
+ from selenium.webdriver.common.keys import Keys
4
6
  from selenium.webdriver.support import expected_conditions as EC
5
7
  from selenium.webdriver.support.ui import Select
6
8
  from selenium.webdriver.support.wait import WebDriverWait
7
9
 
8
10
  from uk_bin_collection.uk_bin_collection.common import *
9
11
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
10
- from selenium.webdriver.common.keys import Keys
11
-
12
12
 
13
13
  # import the wonderful Beautiful Soup and the URL grabber
14
14
 
@@ -35,7 +35,7 @@ class CouncilClass(AbstractGetBinDataClass):
35
35
  check_postcode(user_postcode)
36
36
 
37
37
  # Create Selenium webdriver
38
- driver = create_webdriver(web_driver, headless)
38
+ driver = create_webdriver(web_driver, headless, None, __name__)
39
39
  driver.get(page)
40
40
 
41
41
  # If you bang in the house number (or property name) and postcode in the box it should find your property
@@ -26,7 +26,7 @@ class CouncilClass(AbstractGetBinDataClass):
26
26
  user_uprn = user_uprn.zfill(12)
27
27
 
28
28
  # Create Selenium webdriver
29
- driver = create_webdriver(web_driver, headless)
29
+ driver = create_webdriver(web_driver, headless, None, __name__)
30
30
  driver.get(
31
31
  f"https://my.reigate-banstead.gov.uk/en/service/Bins_and_recycling___collections_calendar?uprn={user_uprn}"
32
32
  )
@@ -27,7 +27,7 @@ class CouncilClass(AbstractGetBinDataClass):
27
27
  check_postcode(user_postcode)
28
28
 
29
29
  # Create Selenium webdriver
30
- driver = create_webdriver(web_driver, headless)
30
+ driver = create_webdriver(web_driver, headless, None, __name__)
31
31
  driver.get(
32
32
  "https://www.renfrewshire.gov.uk/article/2320/Check-your-bin-collection-day"
33
33
  )
@@ -31,7 +31,7 @@ class CouncilClass(AbstractGetBinDataClass):
31
31
  check_postcode(user_postcode)
32
32
 
33
33
  # Create Selenium webdriver
34
- driver = create_webdriver(web_driver, headless)
34
+ driver = create_webdriver(web_driver, headless, None, __name__)
35
35
  driver.get(page)
36
36
 
37
37
  # Populate postcode field
@@ -1,12 +1,12 @@
1
1
  import time
2
2
  from typing import Any
3
3
 
4
+ from dateutil.parser import parse
5
+ from selenium.common.exceptions import NoSuchElementException, TimeoutException
4
6
  from selenium.webdriver.common.by import By
5
7
  from selenium.webdriver.common.keys import Keys
6
- from selenium.common.exceptions import TimeoutException, NoSuchElementException
7
- from selenium.webdriver.support.ui import Select, WebDriverWait
8
8
  from selenium.webdriver.support import expected_conditions as EC
9
- from dateutil.parser import parse
9
+ from selenium.webdriver.support.ui import Select, WebDriverWait
10
10
 
11
11
  from uk_bin_collection.uk_bin_collection.common import create_webdriver, date_format
12
12
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
@@ -32,7 +32,7 @@ class CouncilClass(AbstractGetBinDataClass):
32
32
  user_paon = kwargs.get("paon")
33
33
 
34
34
  # Create Selenium webdriver
35
- driver = create_webdriver(web_driver, headless)
35
+ driver = create_webdriver(web_driver, headless, None, __name__)
36
36
  driver.get(page)
37
37
 
38
38
  # Enter postcode
@@ -26,7 +26,7 @@ class CouncilClass(AbstractGetBinDataClass):
26
26
  check_postcode(user_postcode)
27
27
 
28
28
  # Create Selenium webdriver
29
- driver = create_webdriver(web_driver, headless)
29
+ driver = create_webdriver(web_driver, headless, None, __name__)
30
30
  driver.get("https://www.staffsmoorlands.gov.uk/findyourbinday")
31
31
 
32
32
  # Close cookies banner
@@ -1,11 +1,12 @@
1
1
  from bs4 import BeautifulSoup
2
- from uk_bin_collection.uk_bin_collection.common import *
3
- from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
4
2
  from selenium.webdriver.common.by import By
5
3
  from selenium.webdriver.support import expected_conditions as EC
6
4
  from selenium.webdriver.support.ui import Select
7
5
  from selenium.webdriver.support.wait import WebDriverWait
8
6
 
7
+ from uk_bin_collection.uk_bin_collection.common import *
8
+ from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
9
+
9
10
 
10
11
  # import the wonderful Beautiful Soup and the URL grabber
11
12
  class CouncilClass(AbstractGetBinDataClass):
@@ -28,8 +29,7 @@ class CouncilClass(AbstractGetBinDataClass):
28
29
  check_paon(user_paon)
29
30
  check_postcode(user_postcode)
30
31
 
31
- driver = create_webdriver(web_driver, headless)
32
- # driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))
32
+ driver = create_webdriver(web_driver, headless, None, __name__)
33
33
  driver.get(
34
34
  "https://webapps.sunderland.gov.uk/WEBAPPS/WSS/Sunderland_Portal/Forms/bindaychecker.aspx"
35
35
  )
@@ -17,7 +17,7 @@ class CouncilClass(AbstractGetBinDataClass):
17
17
  try:
18
18
  # Create Selenium webdriver
19
19
  headless = kwargs.get("headless")
20
- driver = create_webdriver(kwargs.get("web_driver"), headless)
20
+ driver = create_webdriver(kwargs.get("web_driver"), headless, None, __name__)
21
21
  driver.get(kwargs.get("url"))
22
22
 
23
23
  # Make a BS4 object
@@ -32,10 +32,7 @@ class CouncilClass(AbstractGetBinDataClass):
32
32
  check_postcode(user_postcode)
33
33
 
34
34
  # Create Selenium webdriver
35
- # driver = create_webdriver(web_driver, headless)
36
- driver = webdriver.Chrome(
37
- service=ChromeService(ChromeDriverManager().install())
38
- )
35
+ driver = create_webdriver(web_driver, headless, None, __name__)
39
36
  driver.get("https://www.westberks.gov.uk/binday")
40
37
 
41
38
  # Wait for the postcode field to appear then populate it
@@ -27,7 +27,7 @@ class CouncilClass(AbstractGetBinDataClass):
27
27
  check_postcode(user_postcode)
28
28
 
29
29
  # Create Selenium webdriver
30
- driver = create_webdriver(web_driver, headless)
30
+ driver = create_webdriver(web_driver, headless, None, __name__)
31
31
  driver.get(
32
32
  "https://www.westlothian.gov.uk/article/31528/Bin-Collection-Calendar-Dates"
33
33
  )
@@ -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("h4", string="Bin collection days")
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
- # Clean-up the bin_name
50
- bin_name_clean = bin_name.strip().replace("\r", "").replace("\n", "")
51
- bin_name_clean = re.sub(' +', ' ', bin_name_clean)
52
-
53
- # Parse the date
54
- next_collection = date_parse(collection_date)
55
- next_collection = next_collection.replace(year=datetime.now().year)
56
-
57
- dict_data = {
58
- "type": bin_name_clean,
59
- "collectionDate": next_collection.strftime(date_format),
60
- }
61
-
62
- data["bins"].append(dict_data)
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uk_bin_collection
3
- Version: 0.74.1
3
+ Version: 0.76.0
4
4
  Summary: Python Lib to collect UK Bin Data
5
5
  Author: Robert Bradley
6
6
  Author-email: robbrad182@gmail.com