From 87caaaa2ca3dd6094d5d33fc2ffebe8d2feb2b35 Mon Sep 17 00:00:00 2001 From: 5ila5 <5ila5@users.noreply.github.com> Date: Fri, 5 Jan 2024 15:08:00 +0100 Subject: [PATCH] doncaster_gov_uk fetches 1 year isntead of 3 weeks --- .../source/doncaster_gov_uk.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/doncaster_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/doncaster_gov_uk.py index d4de244c..ab9e13ae 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/doncaster_gov_uk.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/doncaster_gov_uk.py @@ -1,11 +1,14 @@ -import re -import requests import json +import re from datetime import datetime, timedelta + +import requests from waste_collection_schedule import Collection # type: ignore[attr-defined] TITLE = "City of Doncaster Council" -DESCRIPTION = "Source for doncaster.gov.uk services for the City of Doncaster Council, UK." +DESCRIPTION = ( + "Source for doncaster.gov.uk services for the City of Doncaster Council, UK." +) URL = "https://doncaster.gov.uk" TEST_CASES = { @@ -29,13 +32,11 @@ class Source: def __init__(self, uprn): self._uprn = str(uprn).zfill(12) - def fetch(self): - - # Query needs start and end epoch dates + # Query needs start and end epoch dates today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) - start = (today - timedelta(weeks=3)).strftime("%s") - end = (today + timedelta(weeks=3)).strftime("%s") + start = (today - timedelta(days=365)).strftime("%s") + end = (today + timedelta(days=365)).strftime("%s") url = f"https://www.doncaster.gov.uk/Compass/PremiseDetail/GetCollectionsForCalendar?UPRN={self._uprn}&Start={start}&End={end}" # start = start.strftime("%s") # end = end.strftime("%s")