adding swindon_gov_uk

This commit is contained in:
Josh Willcock
2023-03-12 22:08:58 +00:00
parent fc01539427
commit 210500e5e7
4 changed files with 92 additions and 1 deletions

View File

@@ -466,6 +466,7 @@ Waste collection schedules in the following formats and countries are supported.
- [Southampton City Council](/doc/source/southampton_gov_uk.md) / southampton.gov.uk
- [Stevenage Borough Council](/doc/source/stevenage_gov_uk.md) / stevenage.gov.uk
- [Stockport Council](/doc/source/stockport_gov_uk.md) / stockport.gov.uk
- [Swindon Borough Council](/doc/source/swindon_gov_uk.md) / swindon.gov.uk
- [Telford and Wrekin Council](/doc/source/telford_gov_uk.md) / telford.gov.uk
- [Tewkesbury Borough Council](/doc/source/tewkesbury_gov_uk.md) / tewkesbury.gov.uk
- [The Royal Borough of Kingston Council](/doc/source/kingston_gov_uk.md) / kingston.gov.uk

View File

@@ -0,0 +1,54 @@
import requests
from bs4 import BeautifulSoup
from dateutil import parser
from waste_collection_schedule import Collection
TITLE = "Swindon Borough Council"
DESCRIPTION = "Swindon Borough Council, UK - Waste Collection"
URL = "https://www.swindon.gov.uk"
TEST_CASES = {
"1 Nyland Road": {"uprn": "100121147490"},
"74 Standen Way": {"uprn": "200002922415"},
"1 Eastbury Way": {"uprn": "10010424600"},
"33 Ulysses Road": {"uprn": "10010427033"}
}
ICON_MAP = {
"Rubbish bin": "mdi:trash-can",
"Recycling boxes": "mdi:recycle",
"Garden waste bin": "mdi:leaf",
"Plastics": "mdi:sack",
}
class Source:
def __init__(self, uprn: str):
self.uprn = uprn
self.url = f"{URL}/info/20122/rubbish_and_recycling_collection_days?uprnSubmit=Yes&addressList={self.uprn}"
def fetch(self):
collection_lookup = requests.post(
f"{URL}/info/20122/rubbish_and_recycling_collection_days?uprnSubmit=Yes&addressList={self.uprn}"
)
collection_lookup.raise_for_status()
entries = []
for results in BeautifulSoup(collection_lookup.text, "html.parser").find_all(
"div", class_="bin-collection-content"
):
try:
recyclingdate = results.find("span", class_="nextCollectionDate");
if recyclingdate != None :
recyclingtype = results.find('div', class_='content-left').find("h3");
entries.append(
Collection(
date=parser.parse(recyclingdate.text, dayfirst=True).date(),
t=recyclingtype.text,
icon=ICON_MAP.get(recyclingtype.text),
)
)
except (StopIteration, TypeError):
pass
return entries

View File

@@ -0,0 +1,36 @@
# Swindon Borough Council
Support for schedules provided by [Swindon Borough Council](https://swindon.gov.uk/).
If collection data is available for the address provided, it will return household and recycling waste collection dates.
## Configuration via configuration.yaml
```yaml
waste_collection_schedule:
sources:
- name: swindon_gov_uk
args:
uprn: UPRN
```
### Configuration Variables
**uprn**
*(string) (required)*
Only the UPRN should be supplied in the arguments.
## Examples
```yaml
waste_collection_schedule:
sources:
- name: swindon_gov_uk
args:
uprn: 100121147490
```
## How to find your UPRN
An easy way to discover your Unique Property Reference Number (UPRN) is by going to [Find My Address](https://www.findmyaddress.co.uk/) and providng your address details.

View File

@@ -29,7 +29,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, 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, Lewes District Council, Liverpool City Council, London Borough of Lewisham, 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 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, Southampton City Council, Stevenage Borough Council, Stockport Council, Telford and Wrekin Council, Tewkesbury Borough Council, The Royal Borough of Kingston Council, Uttlesford District Council, Walsall Council, Waverley Borough Council, West Berkshire Council, West Devon Borough 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, Lewes District Council, Liverpool City Council, London Borough of Lewisham, 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 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, Wiltshire Council, Wyre Forest District Council |
| United States of America | City of Pittsburgh, Republic Services, Seattle Public Utilities |
<!--End of country section-->