mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 00:04:11 +01:00
Add East Cambs District Council
This commit is contained in:
@@ -360,6 +360,7 @@ Waste collection schedules in the following formats and countries are supported.
|
||||
- [Cornwall Council](/doc/source/cornwall_gov_uk.md) / cornwall.gov.uk
|
||||
- [Derby City Council](/doc/source/derby_gov_uk.md) / derby.gov.uk
|
||||
- [Eastbourne Borough Council](/doc/source/environmentfirst_co_uk.md) / lewes-eastbourne.gov.uk
|
||||
- [East Cambridgeshire District Council](/doc/source/eastcambs_gov_uk.md) / eastcambs.gov.uk
|
||||
- [East Herts Council](/doc/source/eastherts_gov_uk.md) / eastherts.gov.uk
|
||||
- [Elmbridge Borough Council](/doc/source/elmbridge_gov_uk.md) / elmbridge.gov.uk
|
||||
- [Environment First](/doc/source/environmentfirst_co_uk.md) / environmentfirst.co.uk
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import datetime
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
from waste_collection_schedule import Collection
|
||||
|
||||
TITLE = "East Cambridgeshire District Council"
|
||||
DESCRIPTION = "Source for eastcambs.gov.uk, East Cambridgeshire District Council, UK"
|
||||
URL = "https://www.eastcambs.gov.uk"
|
||||
TEST_CASES = {
|
||||
"East Cambridgeshire District Council, CB7 4EE": {"uprn": 10002597178},
|
||||
}
|
||||
|
||||
API_URL = "https://eastcambs-self.achieveservice.com/appshost/firmstep/self/apps/custompage/bincollections?uprn={uprn}"
|
||||
|
||||
ICON_MAP = {
|
||||
"Black Bag": "mdi:trash-can",
|
||||
"Blue Bin": "mdi:recycle",
|
||||
"Green or Brown Bin": "mdi:leaf",
|
||||
}
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, uprn=None):
|
||||
self._uprn = uprn
|
||||
|
||||
def fetch(self):
|
||||
q = str(API_URL).format(uprn=self._uprn)
|
||||
|
||||
r = requests.get(q)
|
||||
r.raise_for_status()
|
||||
|
||||
responseContent = r.text
|
||||
|
||||
entries = []
|
||||
|
||||
soup = BeautifulSoup(responseContent, "html.parser")
|
||||
x = soup.findAll("div", {"class": "row collectionsrow"})
|
||||
|
||||
for row in x:
|
||||
fields = row.findChildren()
|
||||
if fields[0].text.strip() == "Please select an address to view the upcoming collections.":
|
||||
continue
|
||||
|
||||
entries.append(
|
||||
Collection(
|
||||
date=datetime.datetime.strptime(
|
||||
fields[3].text, "%a - %d %b %Y"
|
||||
).date(),
|
||||
t=fields[2].text,
|
||||
icon=ICON_MAP.get(fields[2].text),
|
||||
)
|
||||
)
|
||||
|
||||
return entries
|
||||
34
doc/source/eastcambs_gov_uk.md
Normal file
34
doc/source/eastcambs_gov_uk.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# East Cambridgeshire District Council
|
||||
|
||||
Support for schedules provided by [East Cambridgeshire District Council](https://www.eastcambs.gov.uk/), serving East Cambridgeshrire district, UK.
|
||||
|
||||
## Configuration via configuration.yaml
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: eastcambs_gov_uk
|
||||
args:
|
||||
uprn: UNIQUE_PROPERTY_REFERENCE_NUMBER
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
**uprn**<br>
|
||||
*(string) (required)*
|
||||
|
||||
|
||||
#### How to find your `UPRN`
|
||||
An easy way to discover your Unique Property Reference Number (UPRN) is by going to https://www.findmyaddress.co.uk/ and entering in your address details.
|
||||
Otherwise you can inspect the web requests the East Cambridgeshire District Council website makes when entering in your postcode and then selecting your address.
|
||||
|
||||
## Example
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: eastcambs_gov_uk
|
||||
args:
|
||||
uprn: 10002597178
|
||||
```
|
||||
2
info.md
2
info.md
@@ -28,7 +28,7 @@ Waste collection schedules from service provider web sites are updated daily, de
|
||||
| Poland | Ecoharmonogram, Warsaw |
|
||||
| Sweden | Landskrona - Svalövs Renhållning, Lerum Vatten och Avlopp, Ronneby Miljöteknik, 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 | Ashfield District 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, City of York Council, Colchester Borough Council, Cornwall Council, Derby City Council, Eastbourne Borough Council, East Herts Council, Elmbridge Borough Council, Environment First, FCC Environment, Guildford Borough Council, Harborough District Council, Harlow Council, Horsham District Council, Huntingdonshire District Council, Lewes District Council, London Borough of Lewisham, Manchester City Council, Middlesbrough Council, Newcastle City Council, Newcastle Under Lyme Borough Council, North Somerset Council, Nottingham City Council, Peterborough City Council, Richmondshire District Council, Rushmoor Borough Council, Salford City Council, Sheffield City Council, South Cambridgeshire District Council, South Hams District Council, South Norfolk and Broadland Council, Southampton City Council, Stevenage Borough Council, Telford and Wrekin Council, Tewkesbury Borough Council, The Royal Borough of Kingston Council, Walsall Council, Waverley Borough Council, West Berkshire Council, West Devon Borough Council, Wiltshire Council, Wyre Forest District Council |
|
||||
| United Kingdom | Ashfield District 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, City of York Council, Colchester Borough Council, Cornwall Council, Derby City Council, Eastbourne Borough Council, East Cambridgeshire District Council, East Herts Council, Elmbridge Borough Council, Environment First, FCC Environment, Guildford Borough Council, Harborough District Council, Harlow Council, Horsham District Council, Huntingdonshire District Council, Lewes District Council, London Borough of Lewisham, Manchester City Council, Middlesbrough Council, Newcastle City Council, Newcastle Under Lyme Borough Council, North Somerset Council, Nottingham City Council, Peterborough City Council, Richmondshire District Council, Rushmoor Borough Council, Salford City Council, Sheffield City Council, South Cambridgeshire District Council, South Hams District Council, South Norfolk and Broadland Council, Southampton City Council, Stevenage Borough Council, Telford and Wrekin Council, Tewkesbury Borough Council, The Royal Borough of Kingston 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-->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user