Add SRV återvinning - changes

change filenames
change sourcename in doc
remove old files
remove dates variable
use params in requests
This commit is contained in:
bbr111
2022-12-26 14:35:20 +01:00
parent 17eddb08fc
commit a961b686f3
4 changed files with 12 additions and 8 deletions

View File

@@ -174,7 +174,7 @@ Currently the following service providers are supported:
- [Lerum.se](./doc/source/lerum_se.md)
- [Ronneby Miljöteknik](./doc/source/miljoteknik_se.md)
- [SSAM.se](./doc/source/ssam_se.md)
- [srvatervinning.se](./doc/source/srv_se.md)
- [srvatervinning.se](./doc/source/srvatervinning_se.md)
- [Sysav.se](./doc/source/sysav_se.md)
- [Vasyd.se](./doc/source/vasyd_se.md)

View File

@@ -3,8 +3,8 @@ import requests
from datetime import datetime
from waste_collection_schedule import Collection
TITLE = "SRV, Sweden"
DESCRIPTION = "Source for SRV, Sweden"
TITLE = "SRV återvinning AB Sweden"
DESCRIPTION = "Source for SRV återvinning AB, Sweden"
URL = "https://www.srvatervinning.se/sophamtning/privat/hamtinformation-och-driftstorningar"
TEST_CASES = {
"Skansvägen" : {"address":"Skansvägen" },
@@ -19,7 +19,12 @@ class Source:
def fetch(self):
r = requests.get('https://www.srvatervinning.se/rest-api/srv-slamsok-rest-new/search?query='+self._address+'&city=')
params = {
"query" : self._address,
"city" : "",
}
url = 'https://www.srvatervinning.se/rest-api/srv-slamsok-rest-new/search'
r = requests.get(url, params)
if r.status_code != 200:
_LOGGER.error("Error querying calender data")
@@ -32,7 +37,6 @@ class Source:
for container in data["results"][0]["containers"]:
type=container["contentType"]
for calentry in container["calendars"]:
dates = {calentry["startDate"],type}
date_obj = datetime.strptime(calentry["startDate"], '%Y-%m-%d').date()
entries.append(Collection(date_obj,type))

View File

@@ -7,7 +7,7 @@ Support for schedules provided by [SRV återvinning AB](https://www.srvatervinni
```yaml
waste_collection_schedule:
sources:
- name: srv_se
- name: srvatervinning_se
args:
address: address
```
@@ -22,7 +22,7 @@ waste_collection_schedule:
```yaml
waste_collection_schedule:
sources:
- name: srv_se
- name: srvatervinning_se
args:
address: "Skansvägen"

View File

@@ -158,7 +158,7 @@ Currently the following service providers are supported:
- [Lerum.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/lerum_se.md)
- [Ronneby Miljöteknik](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/miljoteknik_se.md)
- [srvatervinning.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/srv_se.md)
- [srvatervinning.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/srvatervinning_se.md)
- [SSAM.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/ssam_se.md)
- [Sysav.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/sysav_se.md)
- [Vasyd.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/vasyd_se.md)