integrated scraping in main of sendMatrix.py
This commit is contained in:
parent
d4d4f0d7c7
commit
29c6f5c4ef
|
@ -7,6 +7,8 @@ from markdown2 import Markdown
|
||||||
import asyncio
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
from scraping import get_soup, process_soup, get_events_today
|
||||||
|
|
||||||
MATRIX_URL=os.environ["MATRIX_URL"]
|
MATRIX_URL=os.environ["MATRIX_URL"]
|
||||||
MATRIX_USER=os.environ["MATRIX_USER"]
|
MATRIX_USER=os.environ["MATRIX_USER"]
|
||||||
MATRIX_TOKEN=os.environ["MATRIX_TOKEN"]
|
MATRIX_TOKEN=os.environ["MATRIX_TOKEN"]
|
||||||
|
@ -48,7 +50,11 @@ async def main() -> None:
|
||||||
client = AsyncClient(MATRIX_URL, MATRIX_USER)
|
client = AsyncClient(MATRIX_URL, MATRIX_USER)
|
||||||
client.access_token = MATRIX_TOKEN
|
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()
|
await client.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue