From 29c6f5c4efc0822ba3698df0688c9743f0eb510e Mon Sep 17 00:00:00 2001 From: fredrikr79 Date: Sat, 26 Aug 2023 18:55:04 +0200 Subject: [PATCH] integrated scraping in main of sendMatrix.py --- sendMatrix.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sendMatrix.py b/sendMatrix.py index 32908c8..0d2082f 100644 --- a/sendMatrix.py +++ b/sendMatrix.py @@ -7,6 +7,8 @@ from markdown2 import Markdown import asyncio import datetime +from scraping import get_soup, process_soup, get_events_today + MATRIX_URL=os.environ["MATRIX_URL"] MATRIX_USER=os.environ["MATRIX_USER"] MATRIX_TOKEN=os.environ["MATRIX_TOKEN"] @@ -48,7 +50,11 @@ async def main() -> None: client = AsyncClient(MATRIX_URL, MATRIX_USER) client.access_token = MATRIX_TOKEN - await sendMatrixAnnouncement(Event(1, datetime.datetime.now(), "Name", "Location", "PVV", "Description"), ANNOUNCEMENT_CHANNEL, False) + s = get_soup() + es = get_events_today(process_soup(s)) + + for e in es: + await sendMatrixAnnouncement(e, ANNOUNCEMENT_CHANNEL, False) await client.close()