doncaster_gov_uk fetches 1 year isntead of 3 weeks

This commit is contained in:
5ila5
2024-01-05 15:08:00 +01:00
committed by 5ila5
parent 9f10a415a7
commit 87caaaa2ca

View File

@@ -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")