uk_bin_collection 0.119.0__py3-none-any.whl → 0.123.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. uk_bin_collection/tests/input.json +129 -10
  2. uk_bin_collection/tests/test_common_functions.py +26 -0
  3. uk_bin_collection/uk_bin_collection/common.py +30 -6
  4. uk_bin_collection/uk_bin_collection/councils/AberdeenCityCouncil.py +0 -1
  5. uk_bin_collection/uk_bin_collection/councils/BaberghDistrictCouncil.py +3 -1
  6. uk_bin_collection/uk_bin_collection/councils/BlabyDistrictCouncil.py +8 -5
  7. uk_bin_collection/uk_bin_collection/councils/BlackburnCouncil.py +10 -2
  8. uk_bin_collection/uk_bin_collection/councils/CarmarthenshireCountyCouncil.py +3 -3
  9. uk_bin_collection/uk_bin_collection/councils/CheltenhamBoroughCouncil.py +102 -0
  10. uk_bin_collection/uk_bin_collection/councils/CotswoldDistrictCouncil.py +3 -3
  11. uk_bin_collection/uk_bin_collection/councils/CumberlandAllerdaleCouncil.py +93 -0
  12. uk_bin_collection/uk_bin_collection/councils/EastAyrshireCouncil.py +11 -8
  13. uk_bin_collection/uk_bin_collection/councils/EnvironmentFirst.py +14 -0
  14. uk_bin_collection/uk_bin_collection/councils/FolkstoneandHytheDistrictCouncil.py +81 -0
  15. uk_bin_collection/uk_bin_collection/councils/GlasgowCityCouncil.py +17 -0
  16. uk_bin_collection/uk_bin_collection/councils/HackneyCouncil.py +85 -0
  17. uk_bin_collection/uk_bin_collection/councils/HartlepoolBoroughCouncil.py +83 -0
  18. uk_bin_collection/uk_bin_collection/councils/HighPeakCouncil.py +10 -5
  19. uk_bin_collection/uk_bin_collection/councils/HinckleyandBosworthBoroughCouncil.py +71 -0
  20. uk_bin_collection/uk_bin_collection/councils/KingsLynnandWestNorfolkBC.py +59 -0
  21. uk_bin_collection/uk_bin_collection/councils/LondonBoroughHavering.py +75 -0
  22. uk_bin_collection/uk_bin_collection/councils/LondonBoroughLewisham.py +140 -0
  23. uk_bin_collection/uk_bin_collection/councils/MidSuffolkDistrictCouncil.py +3 -1
  24. uk_bin_collection/uk_bin_collection/councils/MonmouthshireCountyCouncil.py +70 -0
  25. uk_bin_collection/uk_bin_collection/councils/MorayCouncil.py +65 -0
  26. uk_bin_collection/uk_bin_collection/councils/NewcastleUnderLymeCouncil.py +66 -0
  27. uk_bin_collection/uk_bin_collection/councils/NorthHertfordshireDistrictCouncil.py +93 -0
  28. uk_bin_collection/uk_bin_collection/councils/RoyalBoroughofGreenwich.py +113 -0
  29. uk_bin_collection/uk_bin_collection/councils/SandwellBoroughCouncil.py +87 -0
  30. uk_bin_collection/uk_bin_collection/councils/ThurrockCouncil.py +93 -0
  31. uk_bin_collection/uk_bin_collection/councils/WarwickDistrictCouncil.py +29 -10
  32. uk_bin_collection/uk_bin_collection/councils/WestNorthamptonshireCouncil.py +12 -10
  33. uk_bin_collection/uk_bin_collection/councils/WyreForestDistrictCouncil.py +65 -0
  34. {uk_bin_collection-0.119.0.dist-info → uk_bin_collection-0.123.1.dist-info}/METADATA +1 -1
  35. {uk_bin_collection-0.119.0.dist-info → uk_bin_collection-0.123.1.dist-info}/RECORD +38 -21
  36. {uk_bin_collection-0.119.0.dist-info → uk_bin_collection-0.123.1.dist-info}/LICENSE +0 -0
  37. {uk_bin_collection-0.119.0.dist-info → uk_bin_collection-0.123.1.dist-info}/WHEEL +0 -0
  38. {uk_bin_collection-0.119.0.dist-info → uk_bin_collection-0.123.1.dist-info}/entry_points.txt +0 -0
@@ -88,9 +88,10 @@
88
88
  "skip_get_url": true,
89
89
  "house_number": "Monday",
90
90
  "postcode": "Week 1",
91
+ "uprn": "Tuesday",
91
92
  "url": "https://www.babergh.gov.uk",
92
93
  "wiki_name": "Babergh District Council",
93
- "wiki_note": "Use the House Number field to pass the DAY of the week for your collections. Monday/Tuesday/Wednesday/Thursday/Friday. [OPTIONAL] Use the 'postcode' field to pass the WEEK for your garden collection. [Week 1/Week 2]"
94
+ "wiki_note": "Use the House Number field to pass the DAY of the week for your NORMAL collections. [Monday/Tuesday/Wednesday/Thursday/Friday]. [OPTIONAL] Use the 'postcode' field to pass the WEEK for your garden collection. [Week 1/Week 2]. [OPTIONAL] Use the 'uprn' field to pass the DAY for your garden collection. [Monday/Tuesday/Wednesday/Thursday/Friday]"
94
95
  },
95
96
  "BCPCouncil": {
96
97
  "skip_get_url": true,
@@ -363,6 +364,14 @@
363
364
  "wiki_name": "Chelmsford City Council",
364
365
  "wiki_note": "Follow the instructions [here](https://www.chelmsford.gov.uk/myhome/) until you get the page listing your address, then copy the entire address text and use that in the house number field."
365
366
  },
367
+ "CheltenhamBoroughCouncil": {
368
+ "skip_get_url": true,
369
+ "house_number": "Monday",
370
+ "postcode": "Week 1",
371
+ "url": "https://www.cheltenham.gov.uk",
372
+ "wiki_name": "Cheltenham Borough Council",
373
+ "wiki_note": "Use the House Number field to pass the DAY of the week for your collections. [Monday/Tuesday/Wednesday/Thursday/Friday]. Use the 'postcode' field to pass the WEEK (wrapped in quotes) for your collections. [Week 1/Week 2]."
374
+ },
366
375
  "CheshireEastCouncil": {
367
376
  "url": "https://online.cheshireeast.gov.uk/MyCollectionDay/SearchByAjax/GetBartecJobList?uprn=100012791226&onelineaddress=3%20COBBLERS%20YARD,%20SK9%207DZ&_=1689413260149",
368
377
  "wiki_command_url_override": "https://online.cheshireeast.gov.uk/MyCollectionDay/SearchByAjax/GetBartecJobList?uprn=XXXXXXXX&onelineaddress=XXXXXXXX&_=1689413260149",
@@ -468,6 +477,13 @@
468
477
  "wiki_name": "Croydon Council",
469
478
  "wiki_note": "Pass the house number and postcode in their respective parameters."
470
479
  },
480
+ "CumberlandAllerdaleCouncil": {
481
+ "house_number": "2",
482
+ "postcode": "CA13 0DE",
483
+ "url": "https://www.allerdale.gov.uk",
484
+ "wiki_name": "Cumberland Council - Allerdale District",
485
+ "wiki_note": "Pass the house number and postcode in their respective parameters."
486
+ },
471
487
  "DacorumBoroughCouncil": {
472
488
  "house_number": "13",
473
489
  "postcode": "HP3 9JY",
@@ -715,6 +731,13 @@
715
731
  "wiki_name": "Flintshire County Council",
716
732
  "wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find the UPRN."
717
733
  },
734
+ "FolkstoneandHytheDistrictCouncil": {
735
+ "skip_get_url": true,
736
+ "uprn": "50032097",
737
+ "url": "https://www.folkestone-hythe.gov.uk",
738
+ "wiki_name": "Folkstone and Hythe District Council",
739
+ "wiki_note": "Use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find your UPRN."
740
+ },
718
741
  "ForestOfDeanDistrictCouncil": {
719
742
  "house_number": "ELMOGAL, PARKEND ROAD, BREAM, LYDNEY",
720
743
  "postcode": "GL15 6JT",
@@ -773,6 +796,13 @@
773
796
  "wiki_name": "Guildford Council",
774
797
  "wiki_note": "If the bin day is 'today' then the collectionDate will only show today's date if before 7 AM; else the date will be in 'previousCollectionDate'. To get the UPRN, you will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search)."
775
798
  },
799
+ "HackneyCouncil": {
800
+ "house_number": "101",
801
+ "postcode": "N16 9AS",
802
+ "url": "https://www.hackney.gov.uk",
803
+ "wiki_name": "Hackney Council",
804
+ "wiki_note": "Pass the postcode and house number in their respective arguments, both wrapped in quotes."
805
+ },
776
806
  "HaltonBoroughCouncil": {
777
807
  "house_number": "12",
778
808
  "postcode": "WA7 4HA",
@@ -810,6 +840,12 @@
810
840
  "wiki_name": "Harrogate Borough Council",
811
841
  "wiki_note": "Pass the UPRN, which can be found at [this site](https://secure.harrogate.gov.uk/inmyarea). URL doesn't need to be passed."
812
842
  },
843
+ "HartlepoolBoroughCouncil": {
844
+ "url": "https://www.hartlepool.gov.uk",
845
+ "uprn": "100110019551",
846
+ "wiki_name": "Hartlepool Borough Council",
847
+ "wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find your UPRN."
848
+ },
813
849
  "HertsmereBoroughCouncil": {
814
850
  "house_number": "1",
815
851
  "postcode": "WD7 9HZ",
@@ -835,6 +871,12 @@
835
871
  "wiki_name": "High Peak Council",
836
872
  "wiki_note": "Pass the name of the street with the house number parameter, wrapped in double quotes. This parser requires a Selenium webdriver."
837
873
  },
874
+ "HinckleyandBosworthBoroughCouncil": {
875
+ "url": "https://www.hinckley-bosworth.gov.uk",
876
+ "uprn": "100030533512",
877
+ "wiki_name": "Hinckley and Bosworth Borough Council",
878
+ "wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find the UPRN."
879
+ },
838
880
  "HounslowCouncil": {
839
881
  "house_number": "17A LAMPTON PARK ROAD, HOUNSLOW",
840
882
  "postcode": "TW3 4HS",
@@ -865,6 +907,12 @@
865
907
  "wiki_name": "Islington Council",
866
908
  "wiki_note": "Replace XXXXXXXX with your UPRN."
867
909
  },
910
+ "KingsLynnandWestNorfolkBC": {
911
+ "uprn": "10023636886",
912
+ "url": "https://www.west-norfolk.gov.uk/",
913
+ "wiki_name": "Kings Lynn and West Norfolk Borough Council",
914
+ "wiki_note": "Provide your UPRN. Find your UPRN using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
915
+ },
868
916
  "KingstonUponThamesCouncil": {
869
917
  "url": "https://waste-services.kingston.gov.uk/waste/2701097",
870
918
  "wiki_command_url_override": "https://waste-services.kingston.gov.uk/waste/XXXXXXX",
@@ -950,6 +998,12 @@
950
998
  "wiki_name": "London Borough Harrow",
951
999
  "wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find the UPRN."
952
1000
  },
1001
+ "LondonBoroughHavering": {
1002
+ "url": "https://www.havering.gov.uk",
1003
+ "uprn": "100021380730",
1004
+ "wiki_name": "London Borough Havering",
1005
+ "wiki_note": "Pass the UPRN. You can find it using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1006
+ },
953
1007
  "LondonBoroughHounslow": {
954
1008
  "skip_get_url": true,
955
1009
  "uprn": "100021577765",
@@ -964,6 +1018,15 @@
964
1018
  "wiki_name": "London Borough Lambeth",
965
1019
  "wiki_note": "Pass the UPRN. You can find it using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
966
1020
  },
1021
+ "LondonBoroughLewisham": {
1022
+ "postcode": "SE12 9QF",
1023
+ "skip_get_url": true,
1024
+ "uprn": "100021954849",
1025
+ "url": "https://www.lewisham.gov.uk",
1026
+ "web_driver": "http://selenium:4444",
1027
+ "wiki_name": "London Borough Lewisham",
1028
+ "wiki_note": "Pass the UPRN and postcode. To get the UPRN, you can use [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1029
+ },
967
1030
  "LondonBoroughRedbridge": {
968
1031
  "postcode": "IG2 6LQ",
969
1032
  "uprn": "10023770353",
@@ -1015,7 +1078,7 @@
1015
1078
  "wiki_note": "Pass the UPRN. You can find it using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1016
1079
  },
1017
1080
  "MertonCouncil": {
1018
- "url": "https://myneighbourhood.merton.gov.uk/wasteservices/WasteServices.aspx?ID=25851371",
1081
+ "url": "https://myneighbourhood.merton.gov.uk/wasteservices/WasteServices.aspx?ID=25936129",
1019
1082
  "wiki_command_url_override": "https://myneighbourhood.merton.gov.uk/Wasteservices/WasteServices.aspx?ID=XXXXXXXX",
1020
1083
  "wiki_name": "Merton Council",
1021
1084
  "wiki_note": "Follow the instructions [here](https://myneighbourhood.merton.gov.uk/Wasteservices/WasteServicesSearch.aspx) until you get the \"Your recycling and rubbish collection days\" page, then copy the URL and replace the URL in the command."
@@ -1047,9 +1110,10 @@
1047
1110
  "skip_get_url": true,
1048
1111
  "house_number": "Monday",
1049
1112
  "postcode": "Week 2",
1113
+ "uprn": "Monday",
1050
1114
  "url": "https://www.midsuffolk.gov.uk",
1051
1115
  "wiki_name": "Mid Suffolk District Council",
1052
- "wiki_note": "Use the House Number field to pass the DAY of the week for your collections. Monday/Tuesday/Wednesday/Thursday/Friday. [OPTIONAL] Use the 'postcode' field to pass the WEEK for your garden collection. [Week 1/Week 2]"
1116
+ "wiki_note": "Use the House Number field to pass the DAY of the week for your NORMAL collections. [Monday/Tuesday/Wednesday/Thursday/Friday]. [OPTIONAL] Use the 'postcode' field to pass the WEEK for your garden collection. [Week 1/Week 2]. [OPTIONAL] Use the 'uprn' field to pass the DAY for your garden collection. [Monday/Tuesday/Wednesday/Thursday/Friday]"
1053
1117
  },
1054
1118
  "MidSussexDistrictCouncil": {
1055
1119
  "house_number": "OAKLANDS, OAKLANDS ROAD RH16 1SS",
@@ -1074,6 +1138,18 @@
1074
1138
  "wiki_name": "Mole Valley District Council",
1075
1139
  "wiki_note": "UPRN can only be parsed with a valid postcode."
1076
1140
  },
1141
+ "MonmouthshireCountyCouncil": {
1142
+ "url": "https://maps.monmouthshire.gov.uk",
1143
+ "uprn": "100100266220",
1144
+ "wiki_name": "Monmouthshire County Council",
1145
+ "wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find the UPRN."
1146
+ },
1147
+ "MorayCouncil": {
1148
+ "uprn": "28841",
1149
+ "url": "https://bindayfinder.moray.gov.uk/",
1150
+ "wiki_name": "Moray Council",
1151
+ "wiki_note": "Find your property ID by going to (https://bindayfinder.moray.gov.uk), search for your property and extracting the ID from the URL. i.e. (https://bindayfinder.moray.gov.uk/disp_bins.php?id=00028841)"
1152
+ },
1077
1153
  "NeathPortTalbotCouncil": {
1078
1154
  "house_number": "2",
1079
1155
  "postcode": "SA13 3BA",
@@ -1104,6 +1180,12 @@
1104
1180
  "wiki_name": "Newcastle City Council",
1105
1181
  "wiki_note": "Replace XXXXXXXX with your UPRN."
1106
1182
  },
1183
+ "NewcastleUnderLymeCouncil": {
1184
+ "url": "https://www.newcastle-staffs.gov.uk",
1185
+ "uprn": "100031725433",
1186
+ "wiki_name": "Newcastle Under Lyme Council",
1187
+ "wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find your UPRN."
1188
+ },
1107
1189
  "NewhamCouncil": {
1108
1190
  "skip_get_url": true,
1109
1191
  "url": "https://bincollection.newham.gov.uk/Details/Index/000046029461",
@@ -1142,6 +1224,13 @@
1142
1224
  "wiki_name": "North East Lincolnshire Council",
1143
1225
  "wiki_note": "Replace XXXXXXXX with your UPRN."
1144
1226
  },
1227
+ "NorthHertfordshireDistrictCouncil": {
1228
+ "house_number": "2",
1229
+ "postcode": "SG6 4BJ",
1230
+ "url": "https://www.north-herts.gov.uk",
1231
+ "wiki_name": "North Hertfordshire District Council",
1232
+ "wiki_note": "Pass the house number and postcode in their respective parameters."
1233
+ },
1145
1234
  "NorthKestevenDistrictCouncil": {
1146
1235
  "url": "https://www.n-kesteven.org.uk/bins/display?uprn=100030869513",
1147
1236
  "wiki_command_url_override": "https://www.n-kesteven.org.uk/bins/display?uprn=XXXXXXXX",
@@ -1358,6 +1447,14 @@
1358
1447
  "wiki_command_url_override": "https://www.rotherham.gov.uk/bin-collections?address=XXXXXXXXX&submit=Submit",
1359
1448
  "wiki_note": "Replace `XXXXXXXXX` with your UPRN in the URL. You can find your UPRN using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1360
1449
  },
1450
+ "RoyalBoroughofGreenwich": {
1451
+ "house_number": "57",
1452
+ "postcode": "BR7 6DN",
1453
+ "skip_get_url": true,
1454
+ "url": "https://www.royalgreenwich.gov.uk",
1455
+ "wiki_name": "Royal Borough of Greenwich",
1456
+ "wiki_note": "Provide your house number in the `house_number` parameter and your postcode in the `postcode` parameter."
1457
+ },
1361
1458
  "RugbyBoroughCouncil": {
1362
1459
  "postcode": "CV22 6LA",
1363
1460
  "skip_get_url": true,
@@ -1388,6 +1485,13 @@
1388
1485
  "wiki_name": "Salford City Council",
1389
1486
  "wiki_note": "Provide your UPRN. You can find it using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1390
1487
  },
1488
+ "SandwellBoroughCouncil": {
1489
+ "uprn": "10008755549",
1490
+ "skip_get_url": true,
1491
+ "url": "https://www.sandwell.gov.uk",
1492
+ "wiki_name": "Sandwell Borough Council",
1493
+ "wiki_note": "Pass the UPRN. You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1494
+ },
1391
1495
  "SeftonCouncil": {
1392
1496
  "house_number": "1",
1393
1497
  "postcode": "L20 6GG",
@@ -1503,10 +1607,10 @@
1503
1607
  "wiki_note": "You will need to use [FindMyAddress](https://www.findmyaddress.co.uk/search) to find your UPRN."
1504
1608
  },
1505
1609
  "SouthStaffordshireDistrictCouncil": {
1506
- "uprn": "200004523954",
1507
- "url": "https://www.sstaffs.gov.uk/where-i-live?uprn=200004523954",
1508
- "wiki_name": "South Staffordshire District Council",
1509
- "wiki_note": "The URL needs to be `https://www.sstaffs.gov.uk/where-i-live?uprn=<Your_UPRN>`. Replace `<Your_UPRN>` with your UPRN."
1610
+ "uprn": "200004523954",
1611
+ "url": "https://www.sstaffs.gov.uk/where-i-live?uprn=200004523954",
1612
+ "wiki_name": "South Staffordshire District Council",
1613
+ "wiki_note": "The URL needs to be `https://www.sstaffs.gov.uk/where-i-live?uprn=<Your_UPRN>`. Replace `<Your_UPRN>` with your UPRN."
1510
1614
  },
1511
1615
  "SouthTynesideCouncil": {
1512
1616
  "house_number": "1",
@@ -1705,6 +1809,14 @@
1705
1809
  "wiki_name": "Three Rivers District Council",
1706
1810
  "wiki_note": "Provide your UPRN and postcode. Find your UPRN using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1707
1811
  },
1812
+ "ThurrockCouncil": {
1813
+ "skip_get_url": true,
1814
+ "house_number": "Monday",
1815
+ "postcode": "Round A",
1816
+ "url": "https://www.thurrock.gov.uk",
1817
+ "wiki_name": "Thurrock Council",
1818
+ "wiki_note": "Use the House Number field to pass the DAY of the week for your collections. [Monday/Tuesday/Wednesday/Thursday/Friday]. Use the 'postcode' field to pass the ROUND (wrapped in quotes) for your collections. [Round A/Round B]."
1819
+ },
1708
1820
  "TonbridgeAndMallingBC": {
1709
1821
  "postcode": "ME19 4JS",
1710
1822
  "skip_get_url": true,
@@ -1875,11 +1987,11 @@
1875
1987
  "wiki_note": "Provide your UPRN. You can find your UPRN using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1876
1988
  },
1877
1989
  "WestNorthamptonshireCouncil": {
1878
- "postcode": "NN3 2JB",
1990
+ "uprn": "28056796",
1879
1991
  "skip_get_url": true,
1880
- "url": "https://www.northampton.gov.uk/info/200084/bins-waste-and-recycling/1602/check-your-collection-day",
1992
+ "url": "https://www.westnorthants.gov.uk",
1881
1993
  "wiki_name": "West Northamptonshire Council",
1882
- "wiki_note": "Provide your postcode in the `postcode` parameter."
1994
+ "wiki_note": "Provide your UPRN. You can find your UPRN using [FindMyAddress](https://www.findmyaddress.co.uk/search)."
1883
1995
  },
1884
1996
  "WestOxfordshireDistrictCouncil": {
1885
1997
  "house_number": "24",
@@ -1994,6 +2106,13 @@
1994
2106
  "wiki_name": "Wyre Council",
1995
2107
  "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."
1996
2108
  },
2109
+ "WyreForestDistrictCouncil": {
2110
+ "skip_get_url": true,
2111
+ "house_number": "Monday",
2112
+ "url": "https://www.wyreforestdc.gov.uk",
2113
+ "wiki_name": "Wyre Forest District Council",
2114
+ "wiki_note": "Use the House Number field to pass the DAY of the week for your collections. [Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday]."
2115
+ },
1997
2116
  "YorkCouncil": {
1998
2117
  "skip_get_url": true,
1999
2118
  "uprn": "100050535540",
@@ -134,6 +134,32 @@ def test_is_holiday_different_region(mock_holidays_func):
134
134
  assert is_holiday(datetime(2023, 11, 30), Region.ENG) is False
135
135
 
136
136
 
137
+ def test_is_weekend_when_true():
138
+ weekend_date = datetime(2024, 12, 7)
139
+ assert is_weekend(weekend_date) is True
140
+
141
+
142
+ def test_is_weekend_when_false():
143
+ weekend_date = datetime(2024, 12, 6)
144
+ assert is_weekend(weekend_date) is False
145
+
146
+
147
+ def test_is_working_day_when_true():
148
+ working_day_date = datetime(2024, 12, 6)
149
+ assert is_working_day(working_day_date) is True
150
+
151
+
152
+ def test_is_working_day_when_false():
153
+ working_day_date = datetime(2024, 12, 7)
154
+ assert is_working_day(working_day_date) is False
155
+
156
+
157
+ def test_get_next_working_day():
158
+ sample_date = datetime(2024, 12, 7)
159
+ next_working_day = get_next_working_day(sample_date)
160
+ assert next_working_day == datetime(2024, 12, 9)
161
+
162
+
137
163
  def test_remove_alpha_characters():
138
164
  test_string = "12345abc12345"
139
165
  result = remove_alpha_characters(test_string)
@@ -10,7 +10,6 @@ import pandas as pd
10
10
  import requests
11
11
  from dateutil.parser import parse
12
12
  from selenium import webdriver
13
- from selenium.common.exceptions import WebDriverException
14
13
  from selenium.webdriver.chrome.service import Service as ChromeService
15
14
  from urllib3.exceptions import MaxRetryError
16
15
  from webdriver_manager.chrome import ChromeDriverManager
@@ -162,6 +161,31 @@ def is_holiday(date_to_check: datetime, region: Region = Region.ENG) -> bool:
162
161
  return False
163
162
 
164
163
 
164
+ def is_weekend(date_to_check: datetime) -> bool:
165
+ """
166
+ Checks if a given date is a weekend
167
+ :param date_to_check: Date to check if it falls on a weekend
168
+ :return: Bool - true if a weekend day, false if not
169
+ """
170
+ return True if date_to_check.date().weekday() >= 5 else False
171
+
172
+
173
+ def is_working_day(date_to_check: datetime, region: Region = Region.ENG) -> bool:
174
+ """
175
+ Wraps is_holiday() and is_weekend() into one function
176
+ :param date_to_check: Date to check if holiday
177
+ :param region: The UK nation to check. Defaults to ENG.
178
+ :return: Bool - true if a working day (non-holiday, Mon-Fri).
179
+ """
180
+ return False if is_holiday(date_to_check, region) or is_weekend(date_to_check) else True
181
+
182
+
183
+ def get_next_working_day(date: datetime, region: Region = Region.ENG) -> datetime:
184
+ while not is_working_day(date, region):
185
+ date += timedelta(days=1)
186
+ return date
187
+
188
+
165
189
  def get_weekday_dates_in_period(start: datetime, day_of_week: int, amount=8) -> list:
166
190
  """
167
191
  Returns a list of dates of a given weekday from a start date for the given amount of weeks
@@ -208,7 +232,7 @@ def get_next_occurrence_from_day_month(date: datetime) -> datetime:
208
232
 
209
233
  # Check if the target date has already occurred this year
210
234
  if (target_month < current_month) or (
211
- target_month == current_month and target_day < current_day
235
+ target_month == current_month and target_day < current_day
212
236
  ):
213
237
  date = pd.to_datetime(date) + pd.DateOffset(years=1)
214
238
 
@@ -291,10 +315,10 @@ def contains_date(string, fuzzy=False) -> bool:
291
315
 
292
316
 
293
317
  def create_webdriver(
294
- web_driver: str = None,
295
- headless: bool = True,
296
- user_agent: str = None,
297
- session_name: str = None,
318
+ web_driver: str = None,
319
+ headless: bool = True,
320
+ user_agent: str = None,
321
+ session_name: str = None,
298
322
  ) -> webdriver.Chrome:
299
323
  """
300
324
  Create and return a Chrome WebDriver configured for optional headless operation.
@@ -5,7 +5,6 @@ import requests
5
5
  from uk_bin_collection.uk_bin_collection.common import *
6
6
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
7
7
 
8
-
9
8
  # import the wonderful Beautiful Soup and the URL grabber
10
9
  class CouncilClass(AbstractGetBinDataClass):
11
10
  """
@@ -24,6 +24,7 @@ class CouncilClass(AbstractGetBinDataClass):
24
24
 
25
25
  collection_day = kwargs.get("paon")
26
26
  garden_collection_week = kwargs.get("postcode")
27
+ garden_collection_day = kwargs.get("uprn")
27
28
  bindata = {"bins": []}
28
29
 
29
30
  days_of_week = [
@@ -42,6 +43,7 @@ class CouncilClass(AbstractGetBinDataClass):
42
43
  recyclingstartDate = datetime(2024, 11, 11)
43
44
 
44
45
  offset_days = days_of_week.index(collection_day)
46
+ offset_days_garden = days_of_week.index(garden_collection_day)
45
47
  if garden_collection_week:
46
48
  garden_collection = garden_week.index(garden_collection_week)
47
49
 
@@ -155,7 +157,7 @@ class CouncilClass(AbstractGetBinDataClass):
155
157
 
156
158
  collection_date = (
157
159
  datetime.strptime(gardenDate, "%d/%m/%Y")
158
- + timedelta(days=offset_days)
160
+ + timedelta(days=offset_days_garden)
159
161
  ).strftime("%d/%m/%Y")
160
162
 
161
163
  garden_holiday = next(
@@ -31,11 +31,14 @@ class CouncilClass(AbstractGetBinDataClass):
31
31
  for container in soup.find_all(class_="box-item"):
32
32
 
33
33
  # Get the next collection dates from the <p> tag containing <strong>
34
- dates_tag = (
35
- container.find("p", string=lambda text: "Next" in text)
36
- .find_next("p")
37
- .find("strong")
38
- )
34
+ try:
35
+ dates_tag = (
36
+ container.find("p", string=lambda text: "Next" in text)
37
+ .find_next("p")
38
+ .find("strong")
39
+ )
40
+ except:
41
+ continue
39
42
  collection_dates = (
40
43
  dates_tag.text.strip().split(", and then ")
41
44
  if dates_tag
@@ -67,11 +67,19 @@ class CouncilClass(AbstractGetBinDataClass):
67
67
  for collection in bin_collections:
68
68
  if collection is not None:
69
69
  bin_type = collection[0].get("BinType")
70
+ current_collection_date = collection[0].get("CollectionDate")
71
+ if current_collection_date is None:
72
+ continue
70
73
  current_collection_date = datetime.strptime(
71
- collection[0].get("CollectionDate"), "%Y-%m-%d"
74
+ current_collection_date, "%Y-%m-%d"
72
75
  )
76
+ next_collection_date = collection[0].get(
77
+ "NextScheduledCollectionDate"
78
+ )
79
+ if next_collection_date is None:
80
+ continue
73
81
  next_collection_date = datetime.strptime(
74
- collection[0].get("NextScheduledCollectionDate"), "%Y-%m-%d"
82
+ next_collection_date, "%Y-%m-%d"
75
83
  )
76
84
 
77
85
  # Work out the most recent collection date to display
@@ -34,10 +34,10 @@ class CouncilClass(AbstractGetBinDataClass):
34
34
 
35
35
  # Find the next collection date
36
36
  date_tag = container.find(class_="font11 text-center")
37
- if date_tag:
38
- collection_date = date_tag.text.strip()
39
- else:
37
+ if date_tag.text.strip() == "":
40
38
  continue
39
+ else:
40
+ collection_date = date_tag.text.strip()
41
41
 
42
42
  dict_data = {
43
43
  "type": bin_type,
@@ -0,0 +1,102 @@
1
+ import re
2
+ import time
3
+
4
+ import requests
5
+ from bs4 import BeautifulSoup
6
+ from selenium.webdriver.common.by import By
7
+ from selenium.webdriver.support import expected_conditions as EC
8
+ from selenium.webdriver.support.ui import Select
9
+ from selenium.webdriver.support.wait import WebDriverWait
10
+
11
+ from uk_bin_collection.uk_bin_collection.common import *
12
+ from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
13
+
14
+
15
+ # import the wonderful Beautiful Soup and the URL grabber
16
+ class CouncilClass(AbstractGetBinDataClass):
17
+ """
18
+ Concrete classes have to implement all abstract operations of the
19
+ base class. They can also override some operations with a default
20
+ implementation.
21
+ """
22
+
23
+ def parse_data(self, page: str, **kwargs) -> dict:
24
+
25
+ collection_day = kwargs.get("paon")
26
+ collection_week = kwargs.get("postcode")
27
+ bindata = {"bins": []}
28
+
29
+ days_of_week = [
30
+ "Monday",
31
+ "Tuesday",
32
+ "Wednesday",
33
+ "Thursday",
34
+ "Friday",
35
+ "Saturday",
36
+ "Sunday",
37
+ ]
38
+
39
+ week = ["Week 1", "Week 2"]
40
+
41
+ offset_days = days_of_week.index(collection_day)
42
+ collection_week = week.index(collection_week)
43
+
44
+ if collection_week == 0:
45
+ refusestartDate = datetime(2024, 11, 25)
46
+ recyclingstartDate = datetime(2024, 11, 18)
47
+ else:
48
+ refusestartDate = datetime(2024, 11, 18)
49
+ recyclingstartDate = datetime(2024, 11, 25)
50
+
51
+ refuse_dates = get_dates_every_x_days(refusestartDate, 14, 28)
52
+ recycling_dates = get_dates_every_x_days(recyclingstartDate, 14, 28)
53
+ food_dates = get_dates_every_x_days(recyclingstartDate, 7, 56)
54
+
55
+ for refuseDate in refuse_dates:
56
+
57
+ collection_date = (
58
+ datetime.strptime(refuseDate, "%d/%m/%Y") + timedelta(days=offset_days)
59
+ ).strftime("%d/%m/%Y")
60
+
61
+ dict_data = {
62
+ "type": "Refuse Bin",
63
+ "collectionDate": collection_date,
64
+ }
65
+ bindata["bins"].append(dict_data)
66
+
67
+ for recyclingDate in recycling_dates:
68
+
69
+ collection_date = (
70
+ datetime.strptime(recyclingDate, "%d/%m/%Y")
71
+ + timedelta(days=offset_days)
72
+ ).strftime("%d/%m/%Y")
73
+
74
+ dict_data = {
75
+ "type": "Recycling Bin",
76
+ "collectionDate": collection_date,
77
+ }
78
+ bindata["bins"].append(dict_data)
79
+
80
+ dict_data = {
81
+ "type": "Garden Waste Bin",
82
+ "collectionDate": collection_date,
83
+ }
84
+ bindata["bins"].append(dict_data)
85
+
86
+ for food_date in food_dates:
87
+
88
+ collection_date = (
89
+ datetime.strptime(food_date, "%d/%m/%Y") + timedelta(days=offset_days)
90
+ ).strftime("%d/%m/%Y")
91
+
92
+ dict_data = {
93
+ "type": "Food Waste Bin",
94
+ "collectionDate": collection_date,
95
+ }
96
+ bindata["bins"].append(dict_data)
97
+
98
+ bindata["bins"].sort(
99
+ key=lambda x: datetime.strptime(x.get("collectionDate"), "%d/%m/%Y")
100
+ )
101
+
102
+ return bindata
@@ -42,14 +42,14 @@ class CouncilClass(AbstractGetBinDataClass):
42
42
  wait = WebDriverWait(driver, 60)
43
43
  address_entry_field = wait.until(
44
44
  EC.presence_of_element_located(
45
- (By.XPATH, '//*[@id="combobox-input-19"]')
45
+ (By.XPATH, '//*[@id="combobox-input-20"]')
46
46
  )
47
47
  )
48
48
 
49
49
  address_entry_field.send_keys(str(full_address))
50
50
 
51
51
  address_entry_field = wait.until(
52
- EC.element_to_be_clickable((By.XPATH, '//*[@id="combobox-input-19"]'))
52
+ EC.element_to_be_clickable((By.XPATH, '//*[@id="combobox-input-20"]'))
53
53
  )
54
54
  address_entry_field.click()
55
55
  address_entry_field.send_keys(Keys.BACKSPACE)
@@ -57,7 +57,7 @@ class CouncilClass(AbstractGetBinDataClass):
57
57
 
58
58
  first_found_address = wait.until(
59
59
  EC.element_to_be_clickable(
60
- (By.XPATH, '//*[@id="dropdown-element-19"]/ul')
60
+ (By.XPATH, '//*[@id="dropdown-element-20"]/ul')
61
61
  )
62
62
  )
63
63