mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 05:06:33 +01:00
@@ -1,9 +1,14 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
|
||||
# Suppress error messages relating to SSLCertVerificationError
|
||||
import urllib3
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
from waste_collection_schedule import Collection # type: ignore[attr-defined]
|
||||
|
||||
|
||||
TITLE = "Stevenage Borough Council"
|
||||
DESCRIPTION = "Source for stevenage.gov.uk services for Stevenage, UK."
|
||||
URL = "https://stevenage.gov.uk"
|
||||
@@ -30,7 +35,8 @@ class Source:
|
||||
self._postcode = postcode
|
||||
|
||||
def fetch(self):
|
||||
entries = []
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
# Get Round ID and Round Code
|
||||
# Don't fully understand significance of all of the fields, but API borks if they are not present
|
||||
@@ -43,8 +49,8 @@ class Source:
|
||||
}
|
||||
|
||||
headers = {"Content-type": "application/json", "Accept": "text/plain"}
|
||||
roundRequest = requests.post(
|
||||
SEARCH_URLS["round_search"], data=json.dumps(roundData), headers=headers
|
||||
roundRequest = s.post(
|
||||
SEARCH_URLS["round_search"], data=json.dumps(roundData), headers=headers, verify=False
|
||||
)
|
||||
roundJson = json.loads(roundRequest.text)
|
||||
|
||||
@@ -69,10 +75,10 @@ class Source:
|
||||
],
|
||||
}
|
||||
|
||||
collectionRequest = requests.post(
|
||||
collectionRequest = s.post(
|
||||
SEARCH_URLS["collection_search"],
|
||||
data=json.dumps(collectionData),
|
||||
headers=headers,
|
||||
headers=headers,verify=False
|
||||
)
|
||||
collectionJson = json.loads(collectionRequest.text)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user