uk_bin_collection 0.152.1__py3-none-any.whl → 0.152.2__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/uk_bin_collection/councils/CheshireEastCouncil.py +0 -1
- uk_bin_collection/uk_bin_collection/councils/NorthLincolnshireCouncil.py +2 -1
- {uk_bin_collection-0.152.1.dist-info → uk_bin_collection-0.152.2.dist-info}/METADATA +179 -1
- {uk_bin_collection-0.152.1.dist-info → uk_bin_collection-0.152.2.dist-info}/RECORD +7 -7
- {uk_bin_collection-0.152.1.dist-info → uk_bin_collection-0.152.2.dist-info}/LICENSE +0 -0
- {uk_bin_collection-0.152.1.dist-info → uk_bin_collection-0.152.2.dist-info}/WHEEL +0 -0
- {uk_bin_collection-0.152.1.dist-info → uk_bin_collection-0.152.2.dist-info}/entry_points.txt +0 -0
@@ -9,7 +9,6 @@ from uk_bin_collection.uk_bin_collection.get_bin_data import AbstractGetBinDataC
|
|
9
9
|
This module provides bin collection data for Cheshire East Council.
|
10
10
|
"""
|
11
11
|
|
12
|
-
|
13
12
|
class CouncilClass(AbstractGetBinDataClass):
|
14
13
|
"""
|
15
14
|
A class to fetch and parse bin collection data for Cheshire East Council.
|
@@ -46,7 +46,8 @@ class CouncilClass(AbstractGetBinDataClass):
|
|
46
46
|
"type": bin_type,
|
47
47
|
"collectionDate": get_next_occurrence_from_day_month(
|
48
48
|
datetime.strptime(
|
49
|
-
|
49
|
+
remove_ordinal_indicator_from_date_string(
|
50
|
+
c["BinCollectionDate"].replace(" (*)", "").strip())
|
50
51
|
+ " "
|
51
52
|
+ datetime.now().strftime("%Y"),
|
52
53
|
"%A %d %B %Y",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: uk_bin_collection
|
3
|
-
Version: 0.152.
|
3
|
+
Version: 0.152.2
|
4
4
|
Summary: Python Lib to collect UK Bin Data
|
5
5
|
Author: Robert Bradley
|
6
6
|
Author-email: robbrad182@gmail.com
|
@@ -398,6 +398,184 @@ Open the map viewer in VS Code:
|
|
398
398
|

|
399
399
|
|
400
400
|
---
|
401
|
+
## ICS Calendar Generation
|
402
|
+
|
403
|
+
You can convert bin collection data to an ICS calendar file that can be imported into calendar applications like Google Calendar, Apple Calendar, Microsoft Outlook, etc.
|
404
|
+
|
405
|
+
### Overview
|
406
|
+
|
407
|
+
The `bin_to_ics.py` script allows you to:
|
408
|
+
- Convert JSON output from bin collection data into ICS calendar events
|
409
|
+
- Group multiple bin collections on the same day into a single event
|
410
|
+
- Create all-day events (default) or timed events
|
411
|
+
- Add optional reminders/alarms to events
|
412
|
+
- Customize the calendar name
|
413
|
+
|
414
|
+
### Requirements
|
415
|
+
|
416
|
+
- Python 3.6 or higher
|
417
|
+
- The `icalendar` package, which can be installed with:
|
418
|
+
```bash
|
419
|
+
pip install icalendar
|
420
|
+
```
|
421
|
+
|
422
|
+
### Basic Usage
|
423
|
+
|
424
|
+
```bash
|
425
|
+
# Basic usage with stdin input and default output file (bin.ics)
|
426
|
+
python bin_to_ics.py < bin_data.json
|
427
|
+
|
428
|
+
# Specify input and output files
|
429
|
+
python bin_to_ics.py -i bin_data.json -o my_calendar.ics
|
430
|
+
|
431
|
+
# Custom calendar name
|
432
|
+
python bin_to_ics.py -i bin_data.json -o my_calendar.ics -n "My Bin Collections"
|
433
|
+
```
|
434
|
+
|
435
|
+
### Options
|
436
|
+
|
437
|
+
```
|
438
|
+
--input, -i Input JSON file (if not provided, read from stdin)
|
439
|
+
--output, -o Output ICS file (default: bin.ics)
|
440
|
+
--name, -n Calendar name (default: Bin Collections)
|
441
|
+
--alarms, -a Comma-separated list of alarm times before event (e.g., "1d,2h,30m")
|
442
|
+
--no-all-day Create timed events instead of all-day events
|
443
|
+
```
|
444
|
+
|
445
|
+
### Examples
|
446
|
+
|
447
|
+
#### Adding Reminders (Alarms)
|
448
|
+
|
449
|
+
Add reminders 1 day and 2 hours before each collection:
|
450
|
+
|
451
|
+
```bash
|
452
|
+
python bin_to_ics.py -i bin_data.json -a "1d,2h"
|
453
|
+
```
|
454
|
+
|
455
|
+
The time format supports:
|
456
|
+
- Days: `1d`, `2day`, `3days`
|
457
|
+
- Hours: `1h`, `2hour`, `3hours`
|
458
|
+
- Minutes: `30m`, `45min`, `60mins`, `90minutes`
|
459
|
+
|
460
|
+
#### Creating Timed Events
|
461
|
+
|
462
|
+
By default, events are created as all-day events. To create timed events instead (default time: 7:00 AM):
|
463
|
+
|
464
|
+
```bash
|
465
|
+
python bin_to_ics.py -i bin_data.json --no-all-day
|
466
|
+
```
|
467
|
+
|
468
|
+
### Integration with Bin Collection Data Retriever
|
469
|
+
|
470
|
+
You can pipe the output from the bin collection data retriever directly to the ICS generator. The required parameters (postcode, house number, UPRN, etc.) depend on the specific council implementation - refer to the [Quickstart](#quickstart) section above or check the [project wiki](https://github.com/robbrad/UKBinCollectionData/wiki) for details about your council.
|
471
|
+
|
472
|
+
```bash
|
473
|
+
python uk_bin_collection/uk_bin_collection/collect_data.py CouncilName "URL" [OPTIONS] |
|
474
|
+
python bin_to_ics.py [OPTIONS]
|
475
|
+
```
|
476
|
+
|
477
|
+
#### Complete Example for a Council
|
478
|
+
|
479
|
+
```bash
|
480
|
+
python uk_bin_collection/uk_bin_collection/collect_data.py CouncilName \
|
481
|
+
"council_url" \
|
482
|
+
-p "YOUR_POSTCODE" \
|
483
|
+
-n "YOUR_HOUSE_NUMBER" \
|
484
|
+
-w "http://localhost:4444/wd/hub" |
|
485
|
+
python bin_to_ics.py \
|
486
|
+
--name "My Bin Collections" \
|
487
|
+
--output my_bins.ics \
|
488
|
+
--alarms "1d,12h"
|
489
|
+
```
|
490
|
+
|
491
|
+
This will:
|
492
|
+
1. Fetch bin collection data for your address from your council's website
|
493
|
+
2. Convert it to an ICS file named "my_bins.ics"
|
494
|
+
3. Set the calendar name to "My Bin Collections"
|
495
|
+
4. Add reminders 1 day and 12 hours before each collection
|
496
|
+
|
497
|
+
For postcode lookup and UPRN information, please check the [UPRN Finder](#uprn-finder) section above.
|
498
|
+
|
499
|
+
### Using the Calendar
|
500
|
+
|
501
|
+
You have two options for using the generated ICS file:
|
502
|
+
|
503
|
+
#### 1. Importing the Calendar
|
504
|
+
|
505
|
+
You can directly import the ICS file into your calendar application:
|
506
|
+
|
507
|
+
- **Google Calendar**: Go to Settings > Import & export > Import
|
508
|
+
- **Apple Calendar**: File > Import
|
509
|
+
- **Microsoft Outlook**: File > Open & Export > Import/Export > Import an iCalendar (.ics)
|
510
|
+
|
511
|
+
Note: Importing creates a static copy of the calendar events. If bin collection dates change, you'll need to re-import the calendar.
|
512
|
+
|
513
|
+
#### 2. Subscribing to the Calendar
|
514
|
+
|
515
|
+
If you host the ICS file on a publicly accessible web server, you can subscribe to it as an internet calendar:
|
516
|
+
|
517
|
+
- **Google Calendar**: Go to "Other calendars" > "+" > "From URL" > Enter the URL of your hosted ICS file
|
518
|
+
- **Apple Calendar**: File > New Calendar Subscription > Enter the URL
|
519
|
+
- **Microsoft Outlook**: File > Account Settings > Internet Calendars > New > Enter the URL
|
520
|
+
|
521
|
+
Benefits of subscribing:
|
522
|
+
- Calendar automatically updates when the source file changes
|
523
|
+
- No need to manually re-import when bin collection dates change
|
524
|
+
- Easily share the calendar with household members
|
525
|
+
|
526
|
+
You can set up a cron job or scheduled task to regularly:
|
527
|
+
1. Retrieve the latest bin collection data
|
528
|
+
2. Generate a fresh ICS file
|
529
|
+
3. Publish it to a web-accessible location
|
530
|
+
|
531
|
+
### Additional Examples and Use Cases
|
532
|
+
|
533
|
+
#### Automation with Cron Jobs
|
534
|
+
|
535
|
+
Create a weekly update script on a Linux/Mac system:
|
536
|
+
|
537
|
+
```bash
|
538
|
+
#!/bin/bash
|
539
|
+
# File: update_bin_calendar.sh
|
540
|
+
|
541
|
+
# Set variables
|
542
|
+
COUNCIL="YourCouncilName"
|
543
|
+
COUNCIL_URL="https://your-council-website.gov.uk/bins"
|
544
|
+
POSTCODE="YOUR_POSTCODE"
|
545
|
+
HOUSE_NUMBER="YOUR_HOUSE_NUMBER"
|
546
|
+
OUTPUT_DIR="/var/www/html/calendars" # Web-accessible directory
|
547
|
+
CALENDAR_NAME="Household Bins"
|
548
|
+
|
549
|
+
# Ensure output directory exists
|
550
|
+
mkdir -p $OUTPUT_DIR
|
551
|
+
|
552
|
+
# Run the collector and generate the calendar
|
553
|
+
cd /path/to/UKBinCollectionData && \
|
554
|
+
python uk_bin_collection/uk_bin_collection/collect_data.py $COUNCIL "$COUNCIL_URL" \
|
555
|
+
-p "$POSTCODE" -n "$HOUSE_NUMBER" | \
|
556
|
+
python bin_to_ics.py --name "$CALENDAR_NAME" --output "$OUTPUT_DIR/bins.ics" --alarms "1d,6h"
|
557
|
+
|
558
|
+
# Add timestamp to show last update time
|
559
|
+
echo "Calendar last updated: $(date)" > "$OUTPUT_DIR/last_update.txt"
|
560
|
+
```
|
561
|
+
|
562
|
+
Make the script executable:
|
563
|
+
```bash
|
564
|
+
chmod +x update_bin_calendar.sh
|
565
|
+
```
|
566
|
+
|
567
|
+
Add to crontab to run weekly (every Monday at 2 AM):
|
568
|
+
```bash
|
569
|
+
0 2 * * 1 /path/to/update_bin_calendar.sh
|
570
|
+
```
|
571
|
+
|
572
|
+
**Google Assistant/Alexa Integration**
|
573
|
+
|
574
|
+
If you have your calendar connected to Google Calendar or Outlook, you can ask your smart assistant about upcoming bin collections:
|
575
|
+
|
576
|
+
- "Hey Google, when is my next bin collection?"
|
577
|
+
- "Alexa, what's on my calendar tomorrow?" (will include bin collections)
|
578
|
+
|
401
579
|
## Docker API Server
|
402
580
|
We have created an API for this located under [uk_bin_collection_api_server](https://github.com/robbrad/UKBinCollectionData/uk_bin_collection_api_server)
|
403
581
|
|
@@ -76,7 +76,7 @@ uk_bin_collection/uk_bin_collection/councils/CharnwoodBoroughCouncil.py,sha256=F
|
|
76
76
|
uk_bin_collection/uk_bin_collection/councils/ChelmsfordCityCouncil.py,sha256=EB88D0MNJwuDZ2GX1ENc5maGYx17mnHTCtNl6s-v11E,5090
|
77
77
|
uk_bin_collection/uk_bin_collection/councils/CheltenhamBoroughCouncil.py,sha256=bGxfMO4PpTd6ZTfm1hA9tmNUFDKGt20CMJolZ3K_CeM,16411
|
78
78
|
uk_bin_collection/uk_bin_collection/councils/CherwellDistrictCouncil.py,sha256=VxTe9qk93MFgtELEgVrEz3W0vYaG_32EpPmky_b4j0k,2590
|
79
|
-
uk_bin_collection/uk_bin_collection/councils/CheshireEastCouncil.py,sha256=
|
79
|
+
uk_bin_collection/uk_bin_collection/councils/CheshireEastCouncil.py,sha256=RoybPitUD4u0xk4Kc9hXqHbUXCqGJG9Z4uRHWKj4ttk,2495
|
80
80
|
uk_bin_collection/uk_bin_collection/councils/CheshireWestAndChesterCouncil.py,sha256=5mKZf22NgdyBY-SqV0c2q8b8IJobkoZrsfGEVUcxUyM,3544
|
81
81
|
uk_bin_collection/uk_bin_collection/councils/ChesterfieldBoroughCouncil.py,sha256=mZiM8Ugm_OP0JkC5pLaQmi4i79mAp4SNNrcIdsREjHw,7198
|
82
82
|
uk_bin_collection/uk_bin_collection/councils/ChichesterDistrictCouncil.py,sha256=bvtqXSZN64jSND0NxwzJ-WA9H49FwARQMGS3PlUSiUg,6311
|
@@ -216,7 +216,7 @@ uk_bin_collection/uk_bin_collection/councils/NorthEastLincs.py,sha256=fYf438VZIa
|
|
216
216
|
uk_bin_collection/uk_bin_collection/councils/NorthHertfordshireDistrictCouncil.py,sha256=dFgvZqVKEVEP0zSPeh2s9xIWSCGbhYHpXn2U6Nk0HXM,2847
|
217
217
|
uk_bin_collection/uk_bin_collection/councils/NorthKestevenDistrictCouncil.py,sha256=vYOCerJXr9LTP6F2wm4vpYNYbQaWNZ6yfHEQ33N_hTw,1681
|
218
218
|
uk_bin_collection/uk_bin_collection/councils/NorthLanarkshireCouncil.py,sha256=npK1V8D3SLNTSSKkfEpEPvVgXDFyhH_tAsuGogsVKQY,1763
|
219
|
-
uk_bin_collection/uk_bin_collection/councils/NorthLincolnshireCouncil.py,sha256=
|
219
|
+
uk_bin_collection/uk_bin_collection/councils/NorthLincolnshireCouncil.py,sha256=MPzrfdo9YQFVlqBUOM-jDQkacz2DXnygLILQ_ojZeJo,2543
|
220
220
|
uk_bin_collection/uk_bin_collection/councils/NorthNorfolkDistrictCouncil.py,sha256=VV_zqVZYv8ekXcUHhrBlTX_W5qLYE9IA3mT2xmrZqoI,4315
|
221
221
|
uk_bin_collection/uk_bin_collection/councils/NorthNorthamptonshireCouncil.py,sha256=kcMN-5GBjYDM9F1BKfHoYeydub8SuDxHamJbSvJRZ68,2337
|
222
222
|
uk_bin_collection/uk_bin_collection/councils/NorthSomersetCouncil.py,sha256=RNfvvmsBCTJ4GpkvuueF6d9UdJOhp5zzlhzTg2bTO_M,2937
|
@@ -346,8 +346,8 @@ uk_bin_collection/uk_bin_collection/councils/YorkCouncil.py,sha256=I2kBYMlsD4bId
|
|
346
346
|
uk_bin_collection/uk_bin_collection/councils/council_class_template/councilclasstemplate.py,sha256=QD4v4xpsEE0QheR_fGaNOIRMc2FatcUfKkkhAhseyVU,1159
|
347
347
|
uk_bin_collection/uk_bin_collection/create_new_council.py,sha256=m-IhmWmeWQlFsTZC4OxuFvtw5ZtB8EAJHxJTH4O59lQ,1536
|
348
348
|
uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=YvmHfZqanwrJ8ToGch34x-L-7yPe31nB_x77_Mgl_vo,4545
|
349
|
-
uk_bin_collection-0.152.
|
350
|
-
uk_bin_collection-0.152.
|
351
|
-
uk_bin_collection-0.152.
|
352
|
-
uk_bin_collection-0.152.
|
353
|
-
uk_bin_collection-0.152.
|
349
|
+
uk_bin_collection-0.152.2.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
|
350
|
+
uk_bin_collection-0.152.2.dist-info/METADATA,sha256=TkzzP87OZ_9Mqtlf7CjxJSstnyQJveMZzCV_yXX7zHM,26688
|
351
|
+
uk_bin_collection-0.152.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
352
|
+
uk_bin_collection-0.152.2.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
|
353
|
+
uk_bin_collection-0.152.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{uk_bin_collection-0.152.1.dist-info → uk_bin_collection-0.152.2.dist-info}/entry_points.txt
RENAMED
File without changes
|