uk_bin_collection 0.143.3__py3-none-any.whl → 0.143.5__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.
@@ -866,8 +866,7 @@
866
866
  "wiki_note": "Pass the house number, postcode, and UPRN in their respective parameters. This parser requires a Selenium webdriver."
867
867
  },
868
868
  "GooglePublicCalendarCouncil": {
869
- "skip_get_url": true,
870
- "url": "https://calendar.google.com/calendar/ical/c_bca6c975545213622b3958bddab567e1e7398709c63e377b6fe9a9140bd1caf8%40group.calendar.google.com/public/basic.ics",
869
+ "url": "https://calendar.google.com/calendar/ical/0d775884b4db6a7bae5204f06dae113c1a36e505b25991ebc27c6bd42edf5b5e%40group.calendar.google.com/public/basic.ics",
871
870
  "wiki_name": "Google Calendar (Public)",
872
871
  "wiki_note": "The URL should be the public ics file URL for the public Google calendar. See https://support.google.com/calendar/answer/37083?sjid=7202815583021446882-EU. Councils that currently need this are Trafford."
873
872
  },
@@ -1,7 +1,7 @@
1
- from datetime import datetime
1
+ from datetime import datetime, timedelta
2
2
  from typing import Any
3
3
  import requests
4
- from ics import Calendar
4
+ from icalevents.icalevents import events
5
5
 
6
6
  from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataClass
7
7
  from uk_bin_collection.uk_bin_collection.common import date_format
@@ -12,26 +12,26 @@ class CouncilClass(AbstractGetBinDataClass):
12
12
  ics_url: str = kwargs.get("url")
13
13
 
14
14
  if not ics_url:
15
- raise ValueError("Missing required argument: google_calendar_ics_url")
15
+ raise ValueError("Missing required argument: url")
16
16
 
17
- response = requests.get(ics_url)
18
- response.raise_for_status()
17
+ # Get events within the next 90 days
18
+ now = datetime.now()
19
+ future = now + timedelta(days=60)
19
20
 
20
- calendar = Calendar(response.text)
21
- bindata = {"bins": []}
21
+ try:
22
+ upcoming_events = events(ics_url, start=now, end=future)
23
+ except Exception as e:
24
+ raise ValueError(f"Error parsing ICS feed: {e}")
22
25
 
23
- for event in calendar.events:
24
- if not event.name or not event.begin:
25
- continue
26
+ bindata = {"bins": []}
26
27
 
27
- try:
28
- # .begin is a datetime-like object (Arrow)
29
- collection_date = event.begin.date().strftime(date_format)
30
- except Exception:
28
+ for event in sorted(upcoming_events, key=lambda e: e.start):
29
+ if not event.summary or not event.start:
31
30
  continue
32
31
 
33
- bindata["bins"].append(
34
- {"type": event.name, "collectionDate": collection_date}
35
- )
32
+ bindata["bins"].append({
33
+ "type": event.summary,
34
+ "collectionDate": event.start.date().strftime(date_format)
35
+ })
36
36
 
37
37
  return bindata
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uk_bin_collection
3
- Version: 0.143.3
3
+ Version: 0.143.5
4
4
  Summary: Python Lib to collect UK Bin Data
5
5
  Author: Robert Bradley
6
6
  Author-email: robbrad182@gmail.com
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.12
10
10
  Classifier: Programming Language :: Python :: 3.13
11
11
  Requires-Dist: bs4
12
12
  Requires-Dist: holidays
13
- Requires-Dist: ics (>=0.7.2,<0.8.0)
13
+ Requires-Dist: icalevents (>=0.2.1,<0.3.0)
14
14
  Requires-Dist: lxml
15
15
  Requires-Dist: pandas
16
16
  Requires-Dist: python-dateutil
@@ -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=yjo1upzl2zK_UgPqSSZY3mjyY-ItLPJ8CzfL1fDB7vk,121472
6
+ uk_bin_collection/tests/input.json,sha256=4z5vATpVvx8LyiodZuMe55iTCWalBIRMLsELSFTS_uY,121440
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
@@ -129,7 +129,7 @@ uk_bin_collection/uk_bin_collection/councils/GatesheadCouncil.py,sha256=SRCgYhYs
129
129
  uk_bin_collection/uk_bin_collection/councils/GedlingBoroughCouncil.py,sha256=XzfFMCwclh9zAJgsbaj4jywjdiH0wPaFicaVsLrN3ms,2297
130
130
  uk_bin_collection/uk_bin_collection/councils/GlasgowCityCouncil.py,sha256=9Rk9KfcglJvRhh4373OfRX-fwywE2xgwx5KejqzV5fE,3399
131
131
  uk_bin_collection/uk_bin_collection/councils/GloucesterCityCouncil.py,sha256=67D8rbhn0t4rsCSJRTXZVtHmph2wT6rJiexNWKOnMok,4625
132
- uk_bin_collection/uk_bin_collection/councils/GooglePublicCalendarCouncil.py,sha256=oFAfvSA7dH7a9wgse5NAA45J8NJ_ltx4mGoKjDYc7pk,1124
132
+ uk_bin_collection/uk_bin_collection/councils/GooglePublicCalendarCouncil.py,sha256=KiDfL9AVhUlRuY98sbNs_Fb-vUVeo5n1bBShTJHcO8w,1173
133
133
  uk_bin_collection/uk_bin_collection/councils/GraveshamBoroughCouncil.py,sha256=ueQ9xFiTxMUBTGV9VjtySHA1EFWliTM0AeNePBIG9ho,4568
134
134
  uk_bin_collection/uk_bin_collection/councils/GuildfordCouncil.py,sha256=9pVrmQhZcK2AD8gX8mNvP--L4L9KaY6L3B822VX6fec,5695
135
135
  uk_bin_collection/uk_bin_collection/councils/GwyneddCouncil.py,sha256=eK2KkY1NbIxVtBruQYSNPA0J7fuzMik5it02dFbKYV0,1855
@@ -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.3.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
332
- uk_bin_collection-0.143.3.dist-info/METADATA,sha256=gpr8rHY2BBj60Wn_gfXQx6tm8PbcGdchn6kgvm7JW-E,19851
333
- uk_bin_collection-0.143.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
334
- uk_bin_collection-0.143.3.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
335
- uk_bin_collection-0.143.3.dist-info/RECORD,,
331
+ uk_bin_collection-0.143.5.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
332
+ uk_bin_collection-0.143.5.dist-info/METADATA,sha256=gAdCFPPQuB4BwHt34iRKHEYzzhwxjh-ULXZOMU0lMZY,19858
333
+ uk_bin_collection-0.143.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
334
+ uk_bin_collection-0.143.5.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
335
+ uk_bin_collection-0.143.5.dist-info/RECORD,,