mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 05:06:33 +01:00
set user-agent to support new abfall.io api with generic ics
This commit is contained in:
@@ -15,11 +15,20 @@ TEST_CASES = OrderedDict(
|
||||
{
|
||||
"url": "https://www.avl-ludwigsburg.de/fileadmin/Files/Abfallkalender/ICS/Privat/Privat_{%Y}_Ossweil.ics"
|
||||
},
|
||||
)
|
||||
),
|
||||
(
|
||||
"Esslingen, Bahnhof",
|
||||
{
|
||||
"url": "https://api.abfall.io/?kh=DaA02103019b46345f1998698563DaAd&t=ics&s=1a862df26f6943997cef90233877a4fe"
|
||||
},
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
HEADERS = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, url):
|
||||
self.url = url
|
||||
@@ -40,7 +49,7 @@ class Source:
|
||||
|
||||
def fetch_year(self, url):
|
||||
# get ics file
|
||||
r = requests.get(url)
|
||||
r = requests.get(url, headers=HEADERS)
|
||||
r.encoding = "utf-8" # requests doesn't guess the encoding correctly
|
||||
|
||||
entries = []
|
||||
|
||||
Reference in New Issue
Block a user