mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 03:04:09 +01:00
Add runnymede.gov.uk
This commit is contained in:
@@ -198,8 +198,8 @@ Waste collection schedules in the following formats and countries are supported.
|
||||
- [Landkreis Rotenburg (Wümme)](/doc/source/abfall_io.md) / lk-awr.de
|
||||
- [Landkreis Roth](/doc/source/c_trace_de.md) / landratsamt-roth.de
|
||||
- [Landkreis Schweinfurt](/doc/source/awido_de.md) / landkreis-schweinfurt.de
|
||||
- [Landkreis Schwäbisch Hall](/doc/source/cmcitymedia_de.md) / cmcitymedia.de
|
||||
- [Landkreis Schwäbisch Hall](/doc/source/lrasha_de.md) / lrasha.de
|
||||
- [Landkreis Schwäbisch Hall](/doc/source/cmcitymedia_de.md) / cmcitymedia.de
|
||||
- [Landkreis Sigmaringen](/doc/source/abfall_io.md) / landkreis-sigmaringen.de
|
||||
- [Landkreis Südliche Weinstraße](/doc/source/awido_de.md) / suedliche-weinstrasse.de
|
||||
- [Landkreis Tirschenreuth](/doc/source/awido_de.md) / kreis-tir.de
|
||||
@@ -470,6 +470,7 @@ Waste collection schedules in the following formats and countries are supported.
|
||||
- [Oxford City Council](/doc/source/oxford_gov_uk.md) / oxford.gov.uk
|
||||
- [Peterborough City Council](/doc/source/peterborough_gov_uk.md) / peterborough.gov.uk
|
||||
- [Richmondshire District Council](/doc/source/richmondshire_gov_uk.md) / richmondshire.gov.uk
|
||||
- [Runnymede Borough Council](/doc/source/runnymede_gov_uk.md) / runnymede.gov.uk
|
||||
- [Rushmoor Borough Council](/doc/source/rushmoor_gov_uk.md) / rushmoor.gov.uk
|
||||
- [Salford City Council](/doc/source/salford_gov_uk.md) / salford.gov.uk
|
||||
- [Sheffield City Council](/doc/source/sheffield_gov_uk.md) / sheffield.gov.uk
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from waste_collection_schedule import Collection
|
||||
|
||||
TITLE = "Runnymede Borough Council"
|
||||
|
||||
DESCRIPTION = "Source Script for www.runnymede.gov.uk services for Runnymede Borough Council, Surrey, UK"
|
||||
|
||||
URL = "https://www.runnymede.gov.uk"
|
||||
|
||||
TEST_CASES = {
|
||||
"Acacia Close/uprn as string": {"uprn": "100061482004"},
|
||||
"Acacia Close/uprn as number": {"uprn": 100061482004},
|
||||
"Addlestone Library/uprn as string": {"uprn": "10002019806"},
|
||||
"Addlestone Library/uprn as number": {"uprn": 10002019806},
|
||||
}
|
||||
|
||||
API_URL = "https://www.runnymede.gov.uk/bin-collection-day"
|
||||
|
||||
|
||||
ICON_MAP = {
|
||||
"Food caddy": "mdi:food",
|
||||
"Garden waste": "mdi:leaf",
|
||||
"Recycling": "mdi:recycle",
|
||||
"Refuse": "mdi:trash-can",
|
||||
}
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, uprn: str):
|
||||
self._uprn = uprn
|
||||
|
||||
def fetch(self):
|
||||
entries = []
|
||||
session = requests.Session()
|
||||
params = {"address": self._uprn}
|
||||
r = session.get(API_URL, params=params)
|
||||
r.raise_for_status()
|
||||
soup = BeautifulSoup(r.text, features="html.parser")
|
||||
soup.prettify()
|
||||
|
||||
results = soup.find_all("tr")
|
||||
|
||||
for result in results:
|
||||
result_row = result.find_all("td")
|
||||
if (len(result_row) >= 2):
|
||||
date = datetime.strptime(
|
||||
result_row[1].text, "%A, %d %B %Y"
|
||||
).date()
|
||||
|
||||
collection_text = result_row[0].text.strip()
|
||||
for collection_type in ICON_MAP.keys():
|
||||
if collection_type in collection_text:
|
||||
entries.append(
|
||||
Collection(
|
||||
date=date,
|
||||
t=collection_type,
|
||||
icon=ICON_MAP.get(
|
||||
collection_type
|
||||
),
|
||||
)
|
||||
)
|
||||
break
|
||||
# Within a date, sort reversed by type for consistent and logical presentation
|
||||
return sorted(entries, key=lambda x: (x.date, x.type), reverse=True)
|
||||
32
doc/source/runnymede_gov_uk.md
Normal file
32
doc/source/runnymede_gov_uk.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Runnymede Borough Council
|
||||
|
||||
Support for schedules provided by [Runnymede Borough Council](https://www.runnymede.gov.uk/bin-collection-day), serving Runnymede, Surrey, UK.
|
||||
|
||||
## Configuration via configuration.yaml
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: runnymede_gov_uk
|
||||
args:
|
||||
uprn: UPRN_CODE
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
**uprn**
|
||||
*(string) (required)*
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: runnymede_gov_uk
|
||||
args:
|
||||
uprn: "100061482004"
|
||||
```
|
||||
|
||||
## How to get the source argument
|
||||
|
||||
Find the UPRN of your address using [https://www.findmyaddress.co.uk/search](https://www.findmyaddress.co.uk/search).
|
||||
2
info.md
2
info.md
@@ -30,7 +30,7 @@ Waste collection schedules from service provider web sites are updated daily, de
|
||||
| Slovenia | Moji odpadki, Ljubljana |
|
||||
| Sweden | Jönköping - June Avfall & Miljö, Landskrona - Svalövs Renhållning, Lerum Vatten och Avlopp, Linköping - Tekniska Verken, Region Gotland, Ronneby Miljöteknik, Samverkan Återvinning Miljö (SÅM), SRV Återvinning, SSAM, Sysav Sophämntning, Uppsala Vatten och Avfall AB, VA Syd Sophämntning |
|
||||
| Switzerland | A-Region, Andwil, Appenzell, Berg, Bühler, Eggersriet, Gais, Gaiserwald, Goldach, Grosswangen, Grub, Heiden, Herisau, Horn, Hundwil, Häggenschwil, Lindau, Lutzenberg, Muolen, Mörschwil, Münchenstein, Rehetobel, Rorschach, Rorschacherberg, Schwellbrunn, Schönengrund, Speicher, Stein, Steinach, Teufen, Thal, Trogen, Tübach, Untereggen, Urnäsch, Wald, Waldkirch, Waldstatt, Wittenbach, Wolfhalden |
|
||||
| United Kingdom | Amber Valley Borough Council, Ashfield District Council, Basingstoke and Deane Borough Council, Binzone, Blackburn with Darwen Borough Council, Bracknell Forest Council, Bradford Metropolitan District Council, Braintree District Council, Breckland Council, Cambridge City Council, Canterbury City Council, Central Bedfordshire Council, Cheshire East Council, Chesterfield Borough Council, Chichester District Council, City of York Council, Colchester City Council, Cornwall Council, Derby City Council, East Cambridgeshire District Council, East Herts Council, Eastbourne Borough Council, Elmbridge Borough Council, Environment First, FCC Environment, Glasgow City Council, Guildford Borough Council, Harborough District Council, Harlow Council, Herefordshire City Council, Horsham District Council, Huntingdonshire District Council, Leicester City Council, Lewes District Council, Liverpool City Council, London Borough of Bromley, London Borough of Lewisham, London Borough of Merton, Maldon District Council, Manchester City Council, Mid-Sussex District Council, Middlesbrough Council, Newcastle City Council, Newcastle Under Lyme Borough Council, Newport City Council, North Herts Council, North Lincolnshire Council, North Somerset Council, Nottingham City Council, Oxford City Council, Peterborough City Council, Richmondshire District Council, Rushmoor Borough Council, Salford City Council, Sheffield City Council, South Cambridgeshire District Council, South Derbyshire District Council, South Hams District Council, South Norfolk and Broadland Council, South Oxfordshire District Council, Southampton City Council, Stevenage Borough Council, Stockport Council, Swindon Borough Council, Telford and Wrekin Council, Tewkesbury Borough Council, The Royal Borough of Kingston Council, Uttlesford District Council, Vale of White Horse District Council, Walsall Council, Waverley Borough Council, West Berkshire Council, West Devon Borough Council, Wigan Council, Wiltshire Council, Wyre Forest District Council |
|
||||
| United Kingdom | Amber Valley Borough Council, Ashfield District Council, Basingstoke and Deane Borough Council, Binzone, Blackburn with Darwen Borough Council, Bracknell Forest Council, Bradford Metropolitan District Council, Braintree District Council, Breckland Council, Cambridge City Council, Canterbury City Council, Central Bedfordshire Council, Cheshire East Council, Chesterfield Borough Council, Chichester District Council, City of York Council, Colchester City Council, Cornwall Council, Derby City Council, East Cambridgeshire District Council, East Herts Council, Eastbourne Borough Council, Elmbridge Borough Council, Environment First, FCC Environment, Glasgow City Council, Guildford Borough Council, Harborough District Council, Harlow Council, Herefordshire City Council, Horsham District Council, Huntingdonshire District Council, Leicester City Council, Lewes District Council, Liverpool City Council, London Borough of Bromley, London Borough of Lewisham, London Borough of Merton, Maldon District Council, Manchester City Council, Mid-Sussex District Council, Middlesbrough Council, Newcastle City Council, Newcastle Under Lyme Borough Council, Newport City Council, North Herts Council, North Lincolnshire Council, North Somerset Council, Nottingham City Council, Oxford City Council, Peterborough City Council, Richmondshire District Council, Runnymede Borough Council, Rushmoor Borough Council, Salford City Council, Sheffield City Council, South Cambridgeshire District Council, South Derbyshire District Council, South Hams District Council, South Norfolk and Broadland Council, South Oxfordshire District Council, Southampton City Council, Stevenage Borough Council, Stockport Council, Swindon Borough Council, Telford and Wrekin Council, Tewkesbury Borough Council, The Royal Borough of Kingston Council, Uttlesford District Council, Vale of White Horse District Council, Walsall Council, Waverley Borough Council, West Berkshire Council, West Devon Borough Council, Wigan Council, Wiltshire Council, Wyre Forest District Council |
|
||||
| United States of America | City of Pittsburgh, Republic Services, Seattle Public Utilities |
|
||||
<!--End of country section-->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user