specify cal urls im env vars

This commit is contained in:
Tomáš Mládek 2021-06-12 22:02:30 +02:00
parent 8e6a35e6ea
commit 09ac37569f
2 changed files with 5 additions and 6 deletions

6
bot.py
View file

@ -99,10 +99,14 @@ async def main():
except FileNotFoundError:
state = {"notified": [], "notified_soon": []}
urls = os.getenv("PISS_URLS", "").split(",")
if not urls:
raise RuntimeError("No PISS_URLS specified!")
while True:
calendars = []
async with aiohttp.ClientSession() as session:
for url in config.URLS:
for url in urls:
logging.debug(f"Requesting {url}...")
async with session.get(url) as resp:
calendars.append(Calendar(await resp.text()))

View file

@ -3,11 +3,6 @@ class Config:
TG_API_KEY = None
TG_CHAT_ID = None
AVATAR_URL = 'https://gitlab.com/sdbs_cz/piss-bot/-/raw/master/piss.jpg'
URLS = [
'https://sdbs.cz/wp-content/themes/sdbs/file-download.php?type=in',
'https://sdbs.cz/wp-content/themes/sdbs/file-download.php?type=out',
'http://cloud.sdbs.cz/remote.php/dav/public-calendars/R5kWLqcrDFaQYE2e?export'
]
EVENT_TEMPLATE = "<br>".join((
"<b>{title}</b>",
"{date} {location}",